phantomochajs
v1.0.16
Published
Run mocha tests in a PhantomJS (with auto generate test_runner.html)
Downloads
5
Readme
phantomochajs
Auto generate test_runner.html
for client-side tests (mocha + phantomjs)
Installation
$ npm install --save-dev phantomochajs
Usage (with gulp)
If you want to see examples, here is the link below:
- phantomochajs (mocha + phantomjs) + requirejs + backbone
- https://github.com/sh19910711/phantomochajs-example
Example: gulpfile.coffee
gulp = require "gulp"
phantomochajs = require "phantomochajs"
gulp.task "example/test", ->
# specify test scripts in src
gulp.src ["spec/spec_helper.coffee", "spec/**/*_spec.coffee", "spec/**/*_spec.js"]
.pipe phantomochajs(
host: "127.0.0.1"
port: "28080"
)
Run gulp
$ gulp example/test
Result
[21:00:00] Requiring external module coffee-script/register
[21:00:01] Using gulpfile ~/workspace/phantomochajs/gulpfile.coffee
[21:00:01] Starting 'example'...
[21:00:02] Finished 'example' after 573 ms
this is coffeescript
✓ hello
this is javascript
✓ hello
2 passing (5ms)
Options
Key | Type | Default | Description |
--- | --- | --- | --- |
host
| String
| 127.0.0.1
| hostname of the webserver
port
| Number
| 28080
| port of the webserver
server
| Boolean
| false
| keep the webserver
dependencies
| Array
| requirejs | depend modules
test_dependencies
| Array
| mocha, chai, sinon | depended modules on test
reporter
| String
| spec
| mocha reporter
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
MIT
Links
- https://github.com/mrhooray/gulp-mocha-phantomjs
- https://github.com/schickling/gulp-webserver