茉莉花节点测试不是 运行
jasmine-node tests aren't running
我有一个文件 word-count.js
如下所示:
function words(statement) {
words = {}
//some code here that does stuff
return words
}
module.exports = words;
和一个名为 word-count_test.spec.js
的测试套件文件
var words = require('./word-count');
describe("words()", function() {
it("counts one word", function() {
var expectedCounts = { word: 1 };
expect(words("word")).toEqual(expectedCounts);
});
// more tests ...
});
这两个文件在同一个文件夹中,但是当我 运行
$ jasmine-node word-count.js
Finished in 0 seconds
0 tests, 0 assertions, 0 failures, 0 skipped
为什么测试不起作用?
我 运行 jasmine-node 在错误的文件上。
我在做什么(不正确):
jasmine-node word-count.js
我应该做什么(正确):
jasmine-node word-count_test.spec.js
我有一个文件 word-count.js
如下所示:
function words(statement) {
words = {}
//some code here that does stuff
return words
}
module.exports = words;
和一个名为 word-count_test.spec.js
var words = require('./word-count');
describe("words()", function() {
it("counts one word", function() {
var expectedCounts = { word: 1 };
expect(words("word")).toEqual(expectedCounts);
});
// more tests ...
});
这两个文件在同一个文件夹中,但是当我 运行
$ jasmine-node word-count.js
Finished in 0 seconds
0 tests, 0 assertions, 0 failures, 0 skipped
为什么测试不起作用?
我 运行 jasmine-node 在错误的文件上。
我在做什么(不正确):
jasmine-node word-count.js
我应该做什么(正确):
jasmine-node word-count_test.spec.js