简体   繁体   中英

jasmine-node, pass just one spec file as argument

require('jasmine-node')

describe( "hello world", function() {
  it( "a simple app", function(){
    expect("1").toEqual("1")
    console.log("this is a simpler application")
  });
});

I am trying to run the above helloworld program using jasmine-node . But it is not running any tests and shows message as,

0 tests, 0 assertions, 0 failures, 0 skipped

I am not keen on using a configuration file for just one spec file.

I think you have to set a variable equal to the require() . For example,

var jasmineNode = require( "jasmine-node" );

But you don't have to require Jasmine in order to use it. I just deleted the first line (the require() statement) and then ran jasmine-node on the file

jasmine-node hello.spec.js

and it worked.

this is a simpler application
.

Finished in 0.007 seconds
1 test, 1 assertion, 0 failures, 0 skipped

Note that to use jasmine-node this way, you have to have installed it globally with

npm install jasmine-node -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM