Testing for PhantomJS scripts.
PhantomJS unit testing module installable through npm.
Note that PhantomJS must be installed. It must be available in
With npm do:
npm install phantomjs-test-provisions
This adds unit testing to PhantomJS modules. To make use of the global script, use:
npm install -g phantomjs-test-provisions
Write tests in
tests/spectacles.js like this:
describe"phantomjs-test-provisions example test"var mymodule = require"./../../mymodule";it"should exist"shouldexistmymodule;;;
Then run tests like this (if it was installed through
npm install -g):
Using the script through a relative path is also possible and it could be added
package.json like so:
There is also a default example which can run immediately for this project:
Also there is an example using grunt (see