Vows有一个run()方法,它在节点下运行测试,而不使用该vows命令.
在https://github.com/cloudhead/vows/blob/master/lib/vows/suite.js,我们可以看到此方法采用了一个选项参数,该参数允许指定默认值以外的报告者:
this.run = function (options, callback) {
var that = this, start;
options = options || {};
for (var k in options) { this.options[k] = options[k] }
this.matcher = this.options.matcher || this.matcher;
this.reporter = this.options.reporter || this.reporter;
Run Code Online (Sandbox Code Playgroud)
应该在选项对象中传递什么值以选择不同的报告者,例如spec记者?
尝试:
var spec = require("vows/lib/vows/reporters/spec");
// ...
vows.describe("My Tests").addBatch({ /* some batch */ }).run({reporter:spec});
Run Code Online (Sandbox Code Playgroud)
这是对我有用的最简单的方法.
| 归档时间: |
|
| 查看次数: |
559 次 |
| 最近记录: |