Framework for client side unit tests and code coverage combining Babel, Jasmine, Istanbul and Phantom with support for fixtures, ajax mock, ES6, Gulp and Grunt
With focus on performance, everything runs on file://. No server start/stop and no net socket communication between Jasmine, Phantom or Node. It uses stdio.
npm install --save-dev intestify
var intestify = ;;
See example project
See a gulpfile.js that runs only changed specs
This module also works as a Grunt 0.4 plugin. See a gruntfile.js
[options] is an object with the following properties and default values:
reportfolders when using defaults. Otherwise one must set all paths individually.
./testsdirectory and use it as base path
['text-summary', 'lcov', 'clover']
Works with this module's default options
project/├── lib/│ ├── jquery│ │ └── jquery-2.1.4.min.js│ └── etc...├── src/│ ├── app.js│ ├── util.js│ └── etc...└── test/├── fixture/ (optional)│ └── all fixture files... (auto-loaded)├── report/ (auto-created)│ ├── coverage│ │ └── Istanbul reports...│ └── unit│ └── Jasmine reports...├── spec/ (required)│ └── all spec files...└── tmp/ (auto-created)├── isrc.js (generated instrumented src)├── fixture.js (generated fixtures file)├── spec.js (generated combined spec file)└── SpecRunner.html (generated spec runner)
All files from the fixtures glob are loaded and made available as an object to the spec files. Properties are filenames and values are strings. See FixtureSpec example
// on any spec file, get the song.json fixture as a JSONvar song = JSON
// show object with all fixturesconsole;
After running some tests, open the generated spec runner
[base]/[tmp]/SpecRunner.html in a browser with GUI (not Phantom).
It is useful for test development and debug of Jasmine specs
Console shows only a summary report. Open
[base]/[report]/coverage/lcov-report/index.html in a browser for
full coverage report
Copy the original spec runner's template from
to another path and run with option
Edit the new runner as needed but keep the Jasmine and fixture script/style
XHR tests use the included Jasmine Mock ajax.
Example at /example/test/spec/AjaxSpec.js
Remember to run
jasmine.Ajax.install() before any ajax request and
don't bother to turn it off. Usually it's turned on and off because fixtures are
fetched using ajax. This module preload fixtures and do not use ajax
to load them.
This module comes with npm phantom v1.9.8 (as of may 2015). To run with Phantom 2.x, install it and use the option below.
Read the phantomjs module troubleshooting