var jasmine = require('jasmine-node'); describe('Report Comparison ', function () { it('test case', function () { console.log('Inside It'); expect("1").toBe(1); }); });
I have this simple testcase for trial.
But while execution the code inside it
block is not executed.
First, you'll need to install jasmine-node globally.
npm install -g jasmine-node
You don't need to require jasmine-node
in your test file. Just run your test like this instead of node test.js
:
jasmine-node spec/SampleSpec.js // For a single file
jasmine-node spec/ // For running multiple specs inside the `spec/` directory
Straight from the docs,
Note: your specification files must be named as spec.js
, spec.coffee
or spec.litcoffee
, which matches the regular expression /spec\.(js|coffee|litcoffee)$/i
; otherwise jasmine-node won't find them! For example, sampleSpecs.js
is wrong, sampleSpec.js
is right.