Reputation: 16294
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.
Upvotes: 14
Views: 7029
Reputation: 1400
This problem is in the filename.In jasmine-node, the name of file should end with 'spec' *spec.js eg: helloWorldspec.js or abcspec.js To quote from documentation:
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.
Please read more here.
Upvotes: 1
Reputation: 20574
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.
Upvotes: 34
Reputation: 22925
You should upgrade to the latest version of nodejs (currently 0.10.15)
Upvotes: 1
Reputation: 26727
Don't you miss describe
?
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});
Running:
c:\Temp>jasmine-node --verbose my.Spec.js
A suite
contains spec with an expectation
Finished in 0.007 seconds
1 test, 1 assertion, 0 failures, 0 skipped
everything works fine.
Upvotes: 0