我正在使用 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 秒内单独运行,所以我更愿意找出哪一个失败了。
最佳答案
您可以添加标志:--verbose --runInBand 以查看测试用例失败。
使用 --inspect-brk 调试测试用例以获取更多详细信息。
关于typescript - 如何确定哪个 Jest 测试在超时内无法运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62757299/