Class: Jasmine::Runners::PhantomJs

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine-blanket.rb

Instance Method Summary collapse

Instance Method Details

#runObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/jasmine-blanket.rb', line 64

def run
  command = "#{phantom_js_path} '#{File.join(File.dirname(__FILE__), 'phantom_jasmine_runner.js')}' #{jasmine_server_url} #{result_batch_size}"

  IO.popen(command) do |output|
    output.each do |line|
      if line =~ /^jasmine_result/
        line = line.sub(/^jasmine_result/, '')
        raw_results = JSON.parse(line, :max_nesting => false)
        results = raw_results.map { |r| Result.new(r) }
        formatter.format(results)
      elsif line =~ /^coverage_result/
        puts "\n"
        puts line.sub(/^coverage_result/, '')
      end
    end
  end
  formatter.done
end