我有一个文件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
为什么测试无效?
答案 0 :(得分:0)
我在错误的文件上运行jasmine-node。
我在做什么(不正确):
jasmine-node word-count.js
我应该做什么(正确):
jasmine-node word-count_test.spec.js