<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!
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.
Please read Guard usage doc
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.options[:runner] = 'path/to/jasmine.html' task.options[:runner_script] = 'path/to/runner.coffee' end
The location of the test runner:
guard 'phantomjs-jasmine', :runner => '...' do ... end
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();
-
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.
Thanks to Klaus Hartl for guard-phantomjs project.