minijasminenode
Based on Jasmine-Node, but minus the fancy stuff. This node.js module makes Pivotal Lab's Jasmine (http://github.com/pivotal/jasmine) spec framework available in node.js or via the command line.
version notice
minijasminenode comes in two flavors.
This is the branch for minijasminenode. Switch to minijasminenode2.
features
MiniJasmineNode exports a library which
- places Jasmine in Node's global namespace, similar to how it's run in a browser
- adds asynchronous testing with done().
- adds result reporters for the terminal.
- adds focused testing with
iit
and ddescribe
. - adds the ability to load tests from file.
The module also contains a command line wrapper that can be run with
minijasminenode specDir/mySpec1.js specDir/mySpec2.js
For more info on the command line wrapper
minijasminenode --help
installation
Get the library with
npm install minijasminenode
Or, install globally
npm install -g minijasminenode
If you install globally, you can use minijasminenode directly from the command line
minijasminenode mySpecFolder/mySpec.js
usage
var miniJasmineLib = require('minijasminenode');
miniJasmineLib.addSpecs('myTestFolder/mySpec.js');
miniJasmineLib.addReporter(myCustomReporter);
miniJasmineLib.executeSpecs();
You can also pass an options object into executeSpecs
var miniJasmineLib = require('minijasminenode');
var options = {
specs: ['specDir/mySpec1.js', 'specDir/mySpec2.js'],
onComplete: function(runner, log) { console.log('done!'); },
isVerbose: false,
silent: false,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 5000,
showTiming: true,
realtimeFailure: false
};
miniJasmineLib.executeSpecs(options);
to run the tests
./specs.sh
This will run passing tests as well as show examples of how failures look. To run only passing tests, use npm test
or ./bin/minijn spec/*_spec.js