mocha测试报错Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
发布于 9 年前 作者 XueQian 10768 次浏览 最后一次编辑是 8 年前 来自 问答
4 回复

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

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

mocha -t 5000

@joney-pinkman 谢谢了,get

回到顶部