make the runner work with the new report function of jasmine-headless-webkit
This commit is contained in:
parent
4854e1b9c4
commit
34aa0d1420
@ -20,5 +20,5 @@ Gem::Specification.new do |s|
|
|||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
s.add_dependency 'guard', '>= 0.2.2'
|
s.add_dependency 'guard', '>= 0.2.2'
|
||||||
s.add_dependency 'jasmine-headless-webkit'
|
s.add_dependency 'jasmine-headless-webkit', '>= 0.2.2'
|
||||||
end
|
end
|
||||||
|
@ -1,32 +1,17 @@
|
|||||||
require 'guard/notifier'
|
require 'guard/notifier'
|
||||||
require 'open3'
|
|
||||||
|
|
||||||
module Guard
|
module Guard
|
||||||
class JasmineHeadlessWebkitRunner
|
class JasmineHeadlessWebkitRunner
|
||||||
class << self
|
class << self
|
||||||
def run(paths = [])
|
def run(paths = [])
|
||||||
lines = [""]
|
file = Tempfile.new('guard-jasmine-headless-webkit')
|
||||||
|
file.close
|
||||||
|
|
||||||
Open3.popen3(%{jasmine-headless-webkit -c #{paths.join(" ")}}) do |stdin, stdout, stderr|
|
system %{jasmine-headless-webkit --report #{file.path} -c #{paths.join(" ")}}
|
||||||
stdin.close
|
|
||||||
stderr.close
|
|
||||||
while !stdout.eof?
|
|
||||||
$stdout.print (char = stdout.getc)
|
|
||||||
$stdout.flush
|
|
||||||
|
|
||||||
if char.chr == "\n"
|
total, fails, any_console, secs = File.read(file.path).strip.split('/')
|
||||||
lines << ""
|
|
||||||
else
|
|
||||||
lines.last << char.chr
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
total, fails, secs = lines[-2].scan(%r{.* (\d+) tests, (\d+) failures, (.+) secs..*}).flatten
|
Notifier.notify(message(total, fails, secs, any_console == "T"), :title => 'Jasmine results', :image => image(any_console == "T", fails))
|
||||||
|
|
||||||
any_console = lines.any? { |line| line['[console] '] }
|
|
||||||
|
|
||||||
Notifier.notify(message(total, fails, secs, any_console), :title => 'Jasmine results', :image => image(any_console, fails))
|
|
||||||
fails.to_i
|
fails.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user