我正在测试用例中提交网络请求,但这有时需要超过 2 秒(默认超时)。
如何增加单个测试用例的超时?
最佳答案
给你:http://mochajs.org/#test-level
it('accesses the network', function(done){
this.timeout(500);
[Put network code here, with done() in the callback]
})
对于箭头函数使用如下:
it('accesses the network', (done) => {
[Put network code here, with done() in the callback]
}).timeout(500);
关于javascript - 如何增加 Mocha 中单个测试用例的超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15971167/