minijasminenode23
minijasminenode
with Jasmine version 2.4 under the hood.
Original fork from juliemr with an initial update from xdissent to use Jasmine 2.1 (which has since been updated to 2.4).
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.
features
MiniJasmineNode23 exports a library which
- places Jasmine in Node's global namespace, similar to how it's run in a browser.
- adds result reporters for the terminal.
- adds the ability to load tests from file.
- adds focused specs with
iit
andddescribe
. - adds
xdescribe
,fdescribe
,xit
,fit
,beforeEach
,afterEach
,beforeAll
,afterAll
- specification of spec file locations are
glob
-able
The module also contains a command line wrapper.
installation
Get the library with
npm install minijasminenode23
Or, install globally
npm install -g minijasminenode23
If you install globally, you can use minijasminenode directly from the command line
minijasminenode23 mySpecFolder/mySpec.js
See more options
minijasminenode23 --help
usage
// Your test file - mySpecFolder/mySpec.js;
var miniJasmineLib = ; // At this point, jasmine is available in the global node context. // Add your tests by filename. miniJasmineLib; // If you'd like to add a custom Jasmine reporter, you can do so. Tests will // be automatically reported to the terminal. miniJasmineLib; // Run those tests! miniJasmineLib;
You can also pass an options object into executeSpecs
var miniJasmineLib = ; var options = // An array of filenames, relative to current dir. These will be // executed, as well as any tests added with addSpecs() specs: 'specDir/mySpec1.js' 'specDir/mySpec2.js' 'specDir/**/*.spec.js' // A function to call on completion. // function(passed) { console; } // If true, display suite and spec names. isVerbose: false // If true, print colors to the terminal. showColors: true // If true, include stack traces in failures. includeStackTrace: true // Time to wait in milliseconds before a test automatically fails defaultTimeoutInterval: 5000 ; miniJasmineLib;
If you want a custom runner instead of the default add it as an option into executeSpecs
var miniJasmineLib = ; var myCustomReporter = ; // At this point, jasmine is available in the global node context. // Add your tests by filename. miniJasmineLib; // Run those tests! miniJasmineLib;
Grunt Task
A Grunt
task is included, called jasmine23
:
module { grunt grunt grunt
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/minijasminenode23 spec/*_spec.js