option to not run all tests if you don't want it to
This commit is contained in:
parent
7ff876a56f
commit
5e1520a732
@ -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)
|
||||||
|
@ -65,26 +65,41 @@ describe "jasmine-headless-webkit" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'with filtered run' do
|
describe 'with filtered run' do
|
||||||
it "should fail and not run the second" do
|
context "don't run a full run, just the filtered run" do
|
||||||
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml --report #{report} ./spec/jasmine/filtered_failure/failure_spec.js}
|
it "should succeed and run both" do
|
||||||
$?.exitstatus.should == 1
|
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 = File.read(report).strip.split('/')
|
||||||
parts.length.should == 4
|
parts.length.should == 4
|
||||||
parts[0].should == "1"
|
parts[0].should == "1"
|
||||||
parts[1].should == "1"
|
parts[1].should == "0"
|
||||||
parts[2].should == "F"
|
parts[2].should == "F"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should succeed and run both" do
|
context "do both runs" do
|
||||||
system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
|
it "should fail and not run the second" do
|
||||||
$?.exitstatus.should == 0
|
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 = File.read(report).strip.split('/')
|
||||||
parts.length.should == 4
|
parts.length.should == 4
|
||||||
parts[0].should == "2"
|
parts[0].should == "1"
|
||||||
parts[1].should == "0"
|
parts[1].should == "1"
|
||||||
parts[2].should == "F"
|
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
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user