简体   繁体   English

茉莉花节点测试未运行

[英]jasmine-node tests aren't running

I have a file word-count.js that looks like this: 我有一个文件word-count.js看起来像这样:

    function words(statement) {
        words = {}
        //some code here that does stuff
        return words
    }

    module.exports = words;

and a test suite file called word-count_test.spec.js 和一个名为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 ... 
});

The two files are in the same folder, yet when I run 这两个文件位于同一文件夹中,但是当我运行时

$ jasmine-node word-count.js


Finished in 0 seconds
0 tests, 0 assertions, 0 failures, 0 skipped

Why aren't the tests working? 为什么测试不起作用?

I was running jasmine-node on the wrong file. 我在错误的文件上运行jasmine-node。

What I was doing ( incorrect ): 我在做什么( 不正确 ):

jasmine-node word-count.js

What I should be doing ( correct ): 我应该做什么( 正确 ):

jasmine-node word-count_test.spec.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM