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

View File

@ -65,6 +65,20 @@ describe "jasmine-headless-webkit" do
end end
describe 'with filtered run' do describe 'with filtered run' do
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 == "0"
parts[2].should == "F"
end
end
context "do both runs" do
it "should fail and not run the second" 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} 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 $?.exitstatus.should == 1
@ -87,5 +101,6 @@ describe "jasmine-headless-webkit" do
parts[2].should == "F" parts[2].should == "F"
end end
end end
end
end end