have jasmine config set by argument
This commit is contained in:
parent
1c1691f40f
commit
cf5cd24d1b
@ -33,13 +33,14 @@ Let me know via a message or in the Issues section if it works on your setup and
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
jasmine-headless-webkit [options] [path to jasmine.yml, defaults to spec/javascripts/support/jasmine.yml]
|
jasmine-headless-webkit [options]
|
||||||
|
|
||||||
Current supported options:
|
Current supported options:
|
||||||
|
|
||||||
* `-c`/`--colors` enables color output
|
* `-c`/`--colors` enables color output
|
||||||
* `--no-colors` disables color output
|
* `--no-colors` disables color output
|
||||||
* `--keep` preserves the temporary HTML document if an error occurs in testing
|
* `--keep` preserves the temporary HTML document if an error occurs in testing
|
||||||
|
* `-j`/`--jasmine-config` sets the `jasmine.yml` file to load *(defaults to `spec/javascripts/support/jasmine.yml`)*
|
||||||
|
|
||||||
These options can also be placed into a `.jasmine-headless-webkit` file in your project root.
|
These options can also be placed into a `.jasmine-headless-webkit` file in your project root.
|
||||||
|
|
||||||
|
@ -23,13 +23,19 @@ include Jasmine::CLI
|
|||||||
opts = GetoptLong.new(
|
opts = GetoptLong.new(
|
||||||
[ '--colors', '-c', GetoptLong::NO_ARGUMENT ],
|
[ '--colors', '-c', GetoptLong::NO_ARGUMENT ],
|
||||||
[ '--no-colors', GetoptLong::NO_ARGUMENT ],
|
[ '--no-colors', GetoptLong::NO_ARGUMENT ],
|
||||||
[ '--keep', GetoptLong::NO_ARGUMENT ]
|
[ '--keep', GetoptLong::NO_ARGUMENT ],
|
||||||
|
[ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ]
|
||||||
)
|
)
|
||||||
|
|
||||||
options = { :colors => false, :remove_html_file => true }
|
options = {
|
||||||
|
:colors => false,
|
||||||
|
:remove_html_file => true,
|
||||||
|
:jasmine_config => 'spec/javascripts/support/jasmine.yml'
|
||||||
|
}
|
||||||
|
|
||||||
@process_options = lambda { |*args|
|
@process_options = lambda { |*args|
|
||||||
opt = args.flatten.shift
|
opt, arg = args.flatten[0..1]
|
||||||
|
|
||||||
case opt
|
case opt
|
||||||
when '--colors', '-c'
|
when '--colors', '-c'
|
||||||
options[:colors] = true
|
options[:colors] = true
|
||||||
@ -37,13 +43,15 @@ options = { :colors => false, :remove_html_file => true }
|
|||||||
options[:colors] = false
|
options[:colors] = false
|
||||||
when '--keep', '-k'
|
when '--keep', '-k'
|
||||||
options[:remove_html_file] = false
|
options[:remove_html_file] = false
|
||||||
|
when '--jasmine-config', '-j'
|
||||||
|
options[:jasmine_config] = arg
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
read_defaults_file if defaults_file?
|
read_defaults_file if defaults_file?
|
||||||
opts.each(&@process_options)
|
opts.each(&@process_options)
|
||||||
|
|
||||||
data = YAML.load_file(ARGV.shift || 'spec/javascripts/support/jasmine.yml')
|
data = YAML.load_file(options[:jasmine_config])
|
||||||
|
|
||||||
if !File.file?(File.join(gem_dir, RUNNER))
|
if !File.file?(File.join(gem_dir, RUNNER))
|
||||||
puts "The Qt WebKit widget is not compiled! Try re-installing this gem."
|
puts "The Qt WebKit widget is not compiled! Try re-installing this gem."
|
||||||
|
@ -3,21 +3,21 @@ require 'spec_helper'
|
|||||||
describe "jasmine-headless-webkit" do
|
describe "jasmine-headless-webkit" do
|
||||||
describe 'success' do
|
describe 'success' do
|
||||||
it "should succeed with error code 0" do
|
it "should succeed with error code 0" do
|
||||||
%x{bin/jasmine-headless-webkit spec/jasmine/success/success.yml}
|
%x{bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml}
|
||||||
$?.exitstatus.should == 0
|
$?.exitstatus.should == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'failure' do
|
describe 'failure' do
|
||||||
it "should fail with an error code of 1" do
|
it "should fail with an error code of 1" do
|
||||||
%x{bin/jasmine-headless-webkit spec/jasmine/failure/failure.yml}
|
%x{bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml}
|
||||||
$?.exitstatus.should == 1
|
$?.exitstatus.should == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with console.log' do
|
describe 'with console.log' do
|
||||||
it "should succeed, but has a console.log so an error code of 2" do
|
it "should succeed, but has a console.log so an error code of 2" do
|
||||||
%x{bin/jasmine-headless-webkit spec/jasmine/console_log/console_log.yml}
|
%x{bin/jasmine-headless-webkit -j spec/jasmine/console_log/console_log.yml}
|
||||||
$?.exitstatus.should == 2
|
$?.exitstatus.should == 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user