make autotest integration better, and provide for default options using .jasmine-headless-webkit
This commit is contained in:
parent
e2efc83b3a
commit
829d2d2187
21
README.md
21
README.md
@ -19,14 +19,6 @@ serialize.
|
|||||||
|
|
||||||
`gem install jasmine-headless-webkit` or use Bundler.
|
`gem install jasmine-headless-webkit` or use Bundler.
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
jasmine-headless-webkit [options] [path to jasmine.yml, defaults to spec/javascripts/support/jasmine.yml]
|
|
||||||
|
|
||||||
Current supported options:
|
|
||||||
|
|
||||||
* `-c` enables color output
|
|
||||||
|
|
||||||
Installation requires Qt 4.7. See [senchalabs/examples](https://github.com/senchalabs/examples) and [my fork
|
Installation requires Qt 4.7. See [senchalabs/examples](https://github.com/senchalabs/examples) and [my fork
|
||||||
of examples](https://github.com/johnbintz/examples) for more information on the QtWebKit runner.
|
of examples](https://github.com/johnbintz/examples) for more information on the QtWebKit runner.
|
||||||
|
|
||||||
@ -35,12 +27,25 @@ Tested in the following environments:
|
|||||||
* Mac OS X 10.6, with MacPorts Qt and Nokia Qt.mpkg
|
* Mac OS X 10.6, with MacPorts Qt and Nokia Qt.mpkg
|
||||||
* Kubuntu 10.10
|
* Kubuntu 10.10
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
jasmine-headless-webkit [options] [path to jasmine.yml, defaults to spec/javascripts/support/jasmine.yml]
|
||||||
|
|
||||||
|
Current supported options:
|
||||||
|
|
||||||
|
* `-c` enables color output
|
||||||
|
|
||||||
|
These options can also be placed into a `.jasmine-headless-webkit` file in your project root.
|
||||||
|
|
||||||
### Autotest Integration
|
### Autotest Integration
|
||||||
|
|
||||||
`jasmine-headless-webkit` can integrate with Autotest. Your `jasmine.yml` file needs to be in the default
|
`jasmine-headless-webkit` can integrate with Autotest. Your `jasmine.yml` file needs to be in the default
|
||||||
path, and you have to be ready to use a very alpha implementation of the feature. If used with RSpec 2,
|
path, and you have to be ready to use a very alpha implementation of the feature. If used with RSpec 2,
|
||||||
Jasmine tests run after RSpec tests.
|
Jasmine tests run after RSpec tests.
|
||||||
|
|
||||||
|
You need to create a `.jasmine-headless-webkit` file in your project root for this integration
|
||||||
|
to work.
|
||||||
|
|
||||||
### Server Interaction
|
### Server Interaction
|
||||||
|
|
||||||
`jasmine-headless-webkit` works the same as if you create an HTML file, manually load the Jasmine library and
|
`jasmine-headless-webkit` works the same as if you create an HTML file, manually load the Jasmine library and
|
||||||
|
@ -8,14 +8,22 @@ opts = GetoptLong.new(
|
|||||||
[ '--colors', '-c', GetoptLong::NO_ARGUMENT ]
|
[ '--colors', '-c', GetoptLong::NO_ARGUMENT ]
|
||||||
)
|
)
|
||||||
|
|
||||||
colors = false
|
options = { :colors => false }
|
||||||
opts.each do |opt, arg|
|
|
||||||
|
process_options = lambda { |*args|
|
||||||
|
opt = args.shift
|
||||||
case opt
|
case opt
|
||||||
when '--colors'
|
when '--colors', '-c'
|
||||||
colors = true
|
options[:colors] = true
|
||||||
end
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
if File.file?('.jasmine-headless-webkit')
|
||||||
|
File.readlines('.jasmine-headless-webkit').collect { |line| line.strip.split(' ', 2) }.flatten(1).each(&process_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.each(&process_options)
|
||||||
|
|
||||||
data = YAML.load_file(ARGV.shift || 'spec/javascripts/support/jasmine.yml')
|
data = YAML.load_file(ARGV.shift || 'spec/javascripts/support/jasmine.yml')
|
||||||
gem_dir = File.expand_path('../..', __FILE__)
|
gem_dir = File.expand_path('../..', __FILE__)
|
||||||
|
|
||||||
@ -78,7 +86,7 @@ window.console = { log: function(data) { debug.log(JSON.stringify(data)); } };
|
|||||||
HTML
|
HTML
|
||||||
|
|
||||||
File.open(target = "specrunner.#{$$}.html", 'w') { |fh| fh.print output }
|
File.open(target = "specrunner.#{$$}.html", 'w') { |fh| fh.print output }
|
||||||
system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner')} #{colors ? '-c' : ''} #{target}}
|
system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner')} #{options[:colors] ? '-c' : ''} #{target}}
|
||||||
status = $?.exitstatus
|
status = $?.exitstatus
|
||||||
FileUtils.rm_f target
|
FileUtils.rm_f target
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Autotest.add_discovery { 'jasmine' if File.file?('./spec/javascripts/support/jasmine.yml') }
|
Autotest.add_discovery { 'jasmine' if File.file?('./.jasmine-headless-webkit') }
|
||||||
|
@ -73,7 +73,7 @@ module JasmineMixin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def make_jasmine_cmd
|
def make_jasmine_cmd
|
||||||
"#{JASMINE_PROGRAM} -c"
|
"#{JASMINE_PROGRAM}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_jasmine_project_mappings
|
def setup_jasmine_project_mappings
|
||||||
|
Loading…
Reference in New Issue
Block a user