option to not run all tests if you don't want it to

This commit is contained in:
John Bintz 2011-06-10 11:10:09 -04:00
parent 7ff876a56f
commit 5e1520a732
2 changed files with 42 additions and 19 deletions

View File

@ -31,14 +31,16 @@ opts = GetoptLong.new(
[ '--no-colors', GetoptLong::NO_ARGUMENT ],
[ '--keep', GetoptLong::NO_ARGUMENT ],
[ '--report', GetoptLong::REQUIRED_ARGUMENT ],
[ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ]
[ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ],
[ '--no-full-run', GetoptLong::NO_ARGUMENT ]
)
options = {
:colors => false,
:remove_html_file => true,
:jasmine_config => 'spec/javascripts/support/jasmine.yml',
:report => false
:report => false,
:full_run => true
}
@process_options = lambda { |*args|
@ -55,6 +57,8 @@ options = {
options[:report] = arg
when '--jasmine-config', '-j'
options[:jasmine_config] = arg
when '--no-full-run'
options[:full_run] = false
end
}
@ -68,7 +72,11 @@ files_list = Jasmine::FilesList.new(
:only => ARGV.dup
)
system jasmine_command(options, targets = Jasmine::TemplateWriter.write!(files_list))
targets = Jasmine::TemplateWriter.write!(files_list)
run_targets = targets.dup
run_targets.pop if !options[:full_run]
system jasmine_command(options, run_targets)
status = $?.exitstatus
if options[:remove_html_file] || (status == 0)

View File

@ -65,26 +65,41 @@ describe "jasmine-headless-webkit" do
end
describe 'with filtered run' do
it "should fail and not run the second" do
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml --report #{report} ./spec/jasmine/filtered_failure/failure_spec.js}
$?.exitstatus.should == 1
context "don't run a full run, just the filtered run" do
it "should succeed and run both" do
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --no-full-run --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
$?.exitstatus.should == 0
parts = File.read(report).strip.split('/')
parts.length.should == 4
parts[0].should == "1"
parts[1].should == "1"
parts[2].should == "F"
parts = File.read(report).strip.split('/')
parts.length.should == 4
parts[0].should == "1"
parts[1].should == "0"
parts[2].should == "F"
end
end
it "should succeed and run both" do
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
$?.exitstatus.should == 0
context "do both runs" do
it "should fail and not run the second" do
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml --report #{report} ./spec/jasmine/filtered_failure/failure_spec.js}
$?.exitstatus.should == 1
parts = File.read(report).strip.split('/')
parts.length.should == 4
parts[0].should == "2"
parts[1].should == "0"
parts[2].should == "F"
parts = File.read(report).strip.split('/')
parts.length.should == 4
parts[0].should == "1"
parts[1].should == "1"
parts[2].should == "F"
end
it "should succeed and run both" do
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
$?.exitstatus.should == 0
parts = File.read(report).strip.split('/')
parts.length.should == 4
parts[0].should == "2"
parts[1].should == "0"
parts[2].should == "F"
end
end
end
end