Message “Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout”

后端 未结 16 1680
[愿得一人]
[愿得一人] 2020-11-28 02:56

I\'m using Puppeteer and Jest to run some front end tests.

My tests look as follows:

describe("Profile Ta         


        
16条回答
  •  猫巷女王i
    2020-11-28 03:36

    I would like to add (this is a bit long for a comment) that even with a timeout of 3000 my tests would still sometimes (randomly) fail with

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

    Thanks to Tarun's great answer, I think the shortest way to fix a lot of tests is:

    describe('puppeteer tests', () => {
      beforeEach(() => {
        jest.setTimeout(10000);
      });
    
      test('best jest test fest', async () => {
        // Blah
      });
    });
    

提交回复
热议问题