如何确定哪个Jest测试无法在超时时间内运行?

时间:2020-07-06 13:36:49

标签: typescript jestjs nestjs

我正在使用dockerized NestJS,并且正在使用Jest(ts-jest)运行测试。我的一项测试超过了5000毫秒的超时时间,并导致整个测试套件失败,但是命令行输出非常通用(请参见下文)。

   ● Test suite failed to run
nest-test         |
nest-test         |     Timeout - Async callback was not invoked within the 50000 ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 50000 ms timeout specified by jest.setTimeout.
nest-test         |
nest-test         |       at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:29:45)

如何找出导致该错误的测试?

在线其他在线答案建议“只是增加超时时间”,但是我所有的测试应该都应在50秒内单独运行,所以我宁愿找出哪个失败。< / p>

1 个答案:

答案 0 :(得分:1)

您可以添加标志:--verbose --runInBand以查看测试用例失败。

使用--inspect-brk调试测试用例,以获取更多详细信息。