【发布时间】:2014-10-21 16:00:29
【问题描述】:
我有一些 mocha 测试需要来自先前函数调用的数据。但是,由于我的代码使用的是 Web 服务,因此我希望它在运行下一个测试之前等待一段预定的时间。
类似这样的:
var global;
it('should give some info', function(done) {
run.someMethod(param, function(err, result) {
global = result.global
done();
});
});
wait(30000); // basically block it from running the next assertion
it('should give more info', function(done) {
run.anotherMethod(global, function(err, result) {
expect(result).to.be.an('object');
done();
});
});
任何想法将不胜感激。谢谢!
【问题讨论】:
标签: javascript node.js mocha.js