【问题标题】:jasmine-node, pass just one spec file as argumentjasmine-node,只传递一个规范文件作为参数
【发布时间】:2015-11-02 09:37:46
【问题描述】:
require('jasmine-node')

describe( "hello world", function() {
  it( "a simple app", function(){
    expect("1").toEqual("1")
    console.log("this is a simpler application")
  });
});

我正在尝试使用jasmine-node 运行上述 helloworld 程序。但它没有运行任何测试并显示消息为,

0 tests, 0 assertions, 0 failures, 0 skipped

我并不热衷于只为一个规范文件使用配置文件。

【问题讨论】:

    标签: node.js jasmine jasmine-node


    【解决方案1】:

    我认为您必须设置一个等于require() 的变量。例如,

    var jasmineNode = require( "jasmine-node" );
    

    但您不必要求 Jasmine 才能使用它。我刚刚删除了第一行(require() 语句),然后在文件上运行jasmine-node

    jasmine-node hello.spec.js
    

    它成功了。

    this is a simpler application
    .
    
    Finished in 0.007 seconds
    1 test, 1 assertion, 0 failures, 0 skipped
    

    请注意,要以这种方式使用jasmine-node,您必须使用全局安装它

    npm install jasmine-node -g
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-22
      • 2014-02-21
      • 1970-01-01
      • 2014-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多