Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanzure/phantomjs-test-provisions
Unit testing for PhantomJS.
https://github.com/kanzure/phantomjs-test-provisions
Last synced: 9 days ago
JSON representation
Unit testing for PhantomJS.
- Host: GitHub
- URL: https://github.com/kanzure/phantomjs-test-provisions
- Owner: kanzure
- License: other
- Created: 2013-04-21T06:04:36.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-27T06:57:21.000Z (over 11 years ago)
- Last Synced: 2025-01-11T15:56:13.990Z (13 days ago)
- Language: JavaScript
- Homepage: http://npmjs.org/package/phantomjs-test-provisions
- Size: 185 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# phantomjs-test-provisions
[PhantomJS](http://phantomjs.org/) unit testing module installable through npm.
Makes your PhantomJS javascript spaghetti testable, reusable and maybe even
production-ready.phantomjs-test-provisions uses a standalone version of Jasmine. This package is
largely based off of code in the upstream PhantomJS repository. As a separate
node module, it's a quick option for developers interested in adding testing to
their PhantomJS outer context (JavaScriptCore environment).# phantomjs
Note that PhantomJS must be installed. It must be available in `$PATH`.
# install
With [npm](http://npmjs.org/) 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
```# usage
Write tests in `tests/spectacles.js` like this:
``` js
exports.run = function() {
describe("phantomjs-test-provisions example test", function() {
var mymodule = require("./../../mymodule");it("should exist", function() {
should.exist(mymodule);
});
});
}
```Then run tests like this (if it was installed through `npm install -g`):
```
phantomjs-test
```Using the script through a relative path is also possible and it could be added
to a `Gruntfile` or `package.json` like so:```
./node_modules/phantomjs-test-provisions/bin/phantomjs-test
```# writing tests
There are multiple styles available, provided by [Chai](http://chaijs.com/)
including [assert](http://chaijs.com/api/assert/) and
[expect/should](http://chaijs.com/api/bdd/).# who tests the testers?
There is also a default example which can run immediately for this project:
```
npm test
```Also there is an example using grunt (see `Gruntfile.js`):
```
grunt test
```or even:
```
./bin/phantomjs-test
```# license
BSD