【问题标题】:How to specify source files to Jasmine for node.js?如何为 node.js 指定 Jasmine 的源文件?
【发布时间】:2016-08-24 09:50:57
【问题描述】:

我正在开发一个 node.js 库。我想使用 gulp-jasmine 来启动我的测试。

我在 Jasmine 的文档 [1] 和 gulp-jasmine 的文档 [2] 中都找不到如何指定我的源文件的位置。我可以在 Github 上找到的每个使用 jasmine 的项目都只在其 jasmine.json 中指定规范文件。

我应该在文件系统中使用某种模式吗?

链接

  1. https://jasmine.github.io/2.4/node.html
  2. https://www.npmjs.com/package/gulp-jasmine/

【问题讨论】:

    标签: javascript node.js jasmine


    【解决方案1】:

    您应该在规范文件中简单地require 对应的源文件,例如

    var module = require("../module");
    
    describe("add2and3", function () {
      it("should add 2 and 3", function () {
        expect(module.add2and3()).toBe(5);
      });
    });
    

    【讨论】:

      猜你喜欢
      • 2012-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-21
      • 2015-08-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多