No commit activity in last 3 years
No release in over 3 years
PhantomJS guard allows to automatically run PhantomJS (headless, WebKit-based browser) Jasmine specs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

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.