jest超时问题
问题
使用jest单元测试时报以下错误
Timout - Async callback was not invoked within the
5000ms timeout specified by jest.setTimeout.
原因
jest默认超时时间是5000ms,超过5000ms未结束报错。
解决方法
在开头添加
jest.setTimeout(30000); //设置超时时间
参考:https://stackoverflow.com/questions/49603939/message-async-callback-was-not-invoked-within-the-5000-ms-timeout-specified-by
参考:https://jestjs.io/docs/jest-object