nestjs单元测试

  |  

出现的问题

  1. You are trying to import a file after the Jest environment has been torn down.
    或者 TypeError: Right-hand side of ‘instanceof’ is not an object

在最外层加上 jest.useFakeTimers();

  1. Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error:

超时错误
在最外层加上 jest.setTimeout(1000000);

文章目录
  1. 1. 出现的问题