茉莉花节点测试未运行

时间:2015-04-08 00:15:26

标签: javascript node.js jasmine jasmine-node

我有一个文件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

为什么测试无效?

1 个答案:

答案 0 :(得分:0)

我在错误的文件上运行jasmine-node。

我在做什么(不正确):

jasmine-node word-count.js

我应该做什么(正确):

jasmine-node word-count_test.spec.js