guard-phantomjs-jasmine
<img src=“https://secure.travis-ci.org/stas/guard-phantomjs-jasmine.png” alt=“Build Status” />
PhantomJS Jasmine Guard automatically runs Jasmine specs with PhantomJS. It executes the tests and displays the test result. No webserver is required!
Install
Please be sure to have Guard installed before continue.
Add guard definition to your Guardfile by running this command:
guard init phantomjs-jasmine
You will need the Jasmine html runner next. If you have it already, just update your Guardfile pointing :runner to the relevant html file.
Usage
Please read Guard usage doc
CI usecase
You can use builtin rake task if you want to run your specs with Rake
Create a Rakefile with the following
require 'guard/phantomjs-jasmine/task'
Guard::PhantomJsJasmineTask.new
if you want to customize the task, you can use options
require 'guard/phantomjs-jasmine/task'
Guard::PhantomJsJasmineTask.new(:ci) do |task|
task.[:runner] = 'path/to/jasmine.html'
task.[:runner_script] = 'path/to/runner.coffee'
end
Options
The location of the test runner:
guard 'phantomjs-jasmine', :runner => '...' do
...
end
AMD / Require.js support
To make sure the Jasmine is initialized correctly before any test gets executed, we need to detect when Jasmine is loaded.
Add this callback:
if ( window['beforeJasmineExecution'] ) {
beforeJasmineExecution();
}
right before:
jasmineEnv.execute();
Development
-
Report issues, questions, feature requests on GitHub Issues
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.
Authors
Thanks to Klaus Hartl for guard-phantomjs project.