mocha测试报错Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
 发布于 10 年前  作者 XueQian  11919 次预览  最后一次回复是 10 年前  来自 问答 
4 回复
joney-pinkman

mocha测试时默认是2秒的最大执行时间,如果该测试用例执行超过2秒则会报错, 可以在当前执行的用例的describe 的回调中加上一句 this.timeout(xxx) 单位是毫秒 来更改最大执行时间

dayuoba

楼上+1 cli命令也支持参数设置最大timeout

mocha -t 5000