Node.js Jasmine helpers onComplete

Node.js Jasmine helpers onComplete,node.js,jasmine,Node.js,Jasmine,我想设置一个回调,在jasmine完成所有任务后运行 这就是我尝试过的: package.json { "scripts": { "test": "jasmine" } ... "jasmine": "^2.8.0" } spec/support/jasmine.json { "helpers": [ "helpers/env.js", "helpers/**/*.js" ], ... } spec/helpers/env.js ja

我想设置一个回调,在jasmine完成所有任务后运行

这就是我尝试过的:

package.json

{
  "scripts": {
    "test": "jasmine"
  }
  ...
     "jasmine": "^2.8.0"
}
spec/support/jasmine.json

{
  "helpers": [
    "helpers/env.js",
    "helpers/**/*.js"
  ],
  ...
}
spec/helpers/env.js

jasmine.onComplete( () => console.log('yay, done') )
但是不断地出错

$ npm test
...
jasmine.onComplete( () => console.log('yay, done') )
    ^
TypeError: jasmine.onComplete is not a function
...
看来,

你不能初始化茉莉花

var Jasmine = require('jasmine');
var jasmine = new Jasmine();
参考:

然后这应该会起作用:

jasmine.onComplete(function(passed) {
  if(passed) {
    console.log('All specs have passed');
  }
  else {
    console.log('At least one spec has failed');
  }
});

在实现jasmine的地方发布代码