better support for re-running specific specs and getting information on which specs failed
This commit is contained in:
parent
183bd93d31
commit
6bf64edb32
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ moc_*.*
|
||||
hydra-runner.log
|
||||
jhw-test
|
||||
.jhw-cache/
|
||||
_site/
|
||||
|
@ -27,7 +27,7 @@ end
|
||||
|
||||
def compile
|
||||
#system %{cd ext/jasmine-webkit-specrunner && ruby test.rb && ruby extconf.rb}
|
||||
system %{cd ext/jasmine-webkit-specrunner && ruby extconf.rb}
|
||||
system %{cd ext/jasmine-webkit-specrunner && ruby test.rb && ruby extconf.rb}
|
||||
end
|
||||
|
||||
compile
|
||||
|
@ -10,6 +10,7 @@ module Jasmine
|
||||
class ConsoleLogUsage < StandardError ; end
|
||||
|
||||
class JasmineConfigNotFound < Errno::ENOENT ; end
|
||||
class InvalidReport < StandardError ; end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -31,12 +31,12 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def has_used_console?
|
||||
@report.any? { |entry| entry.class == Jasmine::Headless::ReportMessage::Console }
|
||||
@report.any? { |entry| entry.kind_of?(Jasmine::Headless::ReportMessage::Console) }
|
||||
end
|
||||
|
||||
def has_failed_on?(statement)
|
||||
@report.any? { |entry|
|
||||
if entry.class == Jasmine::Headless::ReportMessage::Fail
|
||||
if entry.kind_of?(Jasmine::Headless::ReportMessage::Fail)
|
||||
entry.statement == statement
|
||||
end
|
||||
}
|
||||
@ -46,6 +46,12 @@ module Jasmine::Headless
|
||||
last_total != nil
|
||||
end
|
||||
|
||||
def failed_files
|
||||
@report.find_all { |entry|
|
||||
entry.kind_of?(Jasmine::Headless::ReportMessage::Fail)
|
||||
}.collect(&:filename).uniq
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def last_total
|
||||
|
@ -17,6 +17,10 @@ module Jasmine::Headless::ReportMessage
|
||||
def ==(other)
|
||||
self.statement == other.statement && self.file_info == other.file_info
|
||||
end
|
||||
|
||||
def filename
|
||||
file_info.split(":").first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
11
spec/lib/jasmine/headless/report_message/spec_spec.rb
Normal file
11
spec/lib/jasmine/headless/report_message/spec_spec.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Jasmine::Headless::ReportMessage::Spec do
|
||||
let(:filename) { 'file.js' }
|
||||
let(:spec) { described_class.new("Test", "#{filename}:23") }
|
||||
|
||||
subject { spec }
|
||||
|
||||
its(:filename) { should == filename }
|
||||
end
|
||||
|
@ -18,21 +18,23 @@ describe Jasmine::Headless::Report do
|
||||
before do
|
||||
File.open(file, 'wb') { |fh| fh.puts <<-REPORT }
|
||||
PASS||Statement||One||file.js:23
|
||||
FAIL||Statement||Two||file.js:23
|
||||
FAIL||Statement||Two||file2.js:23
|
||||
FAIL||Statement||Three||file2.js:23
|
||||
CONSOLE||Yes
|
||||
ERROR||Uh oh||file.js:23
|
||||
ERROR||Uh oh||file3.js:23
|
||||
TOTAL||1||2||3||T
|
||||
REPORT
|
||||
end
|
||||
|
||||
it 'should read the report file' do
|
||||
report.length.should == 5
|
||||
report.length.should == 6
|
||||
|
||||
report[0].should == Jasmine::Headless::ReportMessage::Pass.new("Statement One", "file.js:23")
|
||||
report[1].should == Jasmine::Headless::ReportMessage::Fail.new("Statement Two", "file.js:23")
|
||||
report[2].should == Jasmine::Headless::ReportMessage::Console.new("Yes")
|
||||
report[3].should == Jasmine::Headless::ReportMessage::Error.new("Uh oh", "file.js:23")
|
||||
report[4].should == Jasmine::Headless::ReportMessage::Total.new(1, 2, 3, true)
|
||||
report[1].should == Jasmine::Headless::ReportMessage::Fail.new("Statement Two", "file2.js:23")
|
||||
report[2].should == Jasmine::Headless::ReportMessage::Fail.new("Statement Three", "file2.js:23")
|
||||
report[3].should == Jasmine::Headless::ReportMessage::Console.new("Yes")
|
||||
report[4].should == Jasmine::Headless::ReportMessage::Error.new("Uh oh", "file3.js:23")
|
||||
report[5].should == Jasmine::Headless::ReportMessage::Total.new(1, 2, 3, true)
|
||||
|
||||
report.total.should == 1
|
||||
report.failed.should == 2
|
||||
@ -42,6 +44,7 @@ REPORT
|
||||
report.should be_valid
|
||||
|
||||
report.should have_failed_on("Statement Two")
|
||||
report.failed_files.should == [ 'file2.js' ]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user