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

后端 未结 16 1607
[愿得一人]
[愿得一人] 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条回答
  •  孤城傲影
    2020-11-28 03:39

    You can also get timeout errors based on silly typos. e.g This seemingly innocuous mistake:

    describe('Something', () => {
      it('Should do something', () => {
        expect(1).toEqual(1)
      })
    
      it('Should do nothing', something_that_does_not_exist => {
        expect(1).toEqual(1)
      })
    })
    

    Produces the following error:

    FAIL src/TestNothing.spec.js (5.427s)
      ● Something › Should do nothing
    
        Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
          
          at node_modules/jest-jasmine2/build/queue_runner.js:68:21
          at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19)
    

    Whilst the code sample posted doesn't suffer from this it might be a cause of failures elsewhere. Also note that I'm not setting a timeout for anything anywhere - either here or the config the 5000ms is just the default setting.

提交回复
热议问题