Skip to content

Phantomjs guard automatically runs PhantomJS with a driver and a URL, usually a web server hosting tests. It executes the tests and displays the test result.

License

stas/guard-phantomjs-jasmine

 
 

Repository files navigation

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.options[:runner] = 'path/to/jasmine.html'
  task.options[: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

Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.

Authors

Stas Suscov

Thanks to Klaus Hartl for guard-phantomjs project.

About

Phantomjs guard automatically runs PhantomJS with a driver and a URL, usually a web server hosting tests. It executes the tests and displays the test result.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 79.6%
  • JavaScript 14.0%
  • CoffeeScript 6.4%