【发布时间】:2016-03-28 04:06:47
【问题描述】:
我正在尝试遍历一些选项并基于 mocha 中的这些选项构建测试。我已经设置了一个简单的概念证明,用于大致基于以下要点进行动态测试:https://gist.github.com/cybertk/fff8992e12a7655157ed
我在运行 dynamicSuite.addTest() 时不断收到错误:“TypeError:test.retries 不是函数”。我无法弄清楚是什么导致了错误。这种在 mocha 中构建测试的方法似乎没有太多文档。
代码如下:
var dynamicSuite = describe('dynamic suite', function() {
this.timeout(10000);
before( function (done) {
var a = ['a', 'b', 'c'];
for(let item of a){
dynamicSuite.addTest(new common.Mocha.Test('test' + item, function(done){
done();
}));
}
done();
});
it('this is needed to make sure tests run', function (done) {
done();
});
after(function(done) {
done();
});
});//end describe test block
【问题讨论】:
标签: javascript tdd mocha.js suite