I expect this to say "1 test", but it says "0 tests". Any idea why? This is on OS X.
$ jasmine-node --verbose my.spec.js
undefined
Finished in 0.001 seconds
0 tests, 0 assertions, 0 failures, 0 skipped
$ cat my.spec.js
describe("bar", function() {
it("works", function() {
expect("foo").toEqual("foo");
});
});
$ jasmine-node --version
1.11.0
$ npm --version
1.3.5
$ node -v
v0.4.12
Even if I try to create a syntax error I get the same output:
$ cat my.spec.js
it(
$ jasmine-node --verbose --captureExceptions my.spec.js
undefined
Finished in 0.001 seconds
0 tests, 0 assertions, 0 failures, 0 skipped
But if I try to specify a file that doesn't exist, it complains:
$ jasmine-node no.spec.js
File: /tmp/no.spec.js is missing.
In order to test a Node. js application, the jasmine framework needs to be installed first. This is done by using the Node package manager. The test code needs to be written in a separate file, and the word 'spec' should be appended to the file name.
NODE AND BROWSER Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests. Get Started.
I also had this problem, it was that I didn't name the file correctly:
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.
Source: https://github.com/mhevery/jasmine-node
You should upgrade to the latest version of nodejs (currently 0.10.15)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With