Skip to content

Async callback was not invoked within the 5000ms timeout - Error Message Improvement #8384

@DannyBrown-xx

Description

@DannyBrown-xx

🐛 Bug Report

I have some tests which have always passed until a recent merge. They now show the following error:

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

However I can see that the tests do indeed finish and are not long running.

Screenshot 2019-04-26 at 16 24 08

Having read https://jestjs.io/docs/en/troubleshooting#unresolved-promises I can see that this issue may in-fact relate more to having multiple promise libraries being used. As a relatively recent project all of our code uses async/await so we are not using any promise libraries directly. However, I can see some are in our node_modules directory.

> ls node_modules | grep "promise"
p-is-promise
request-promise-core
request-promise-native

My bug report pertains to the above error message, perhaps we could improve it by adding a link to the documentation that explains that multiple promise implementations could be an issue (I spent over an hour trying to solve this issue before coming across this information) 👍.

In addition, I think it would be good to add some more information to the docs site about why this happens and more detailed information for how to resolve if you, like I, are in a position where you don't use any promise libraries and frankly don't know where to start to debug this issue.

If anyone could chime in to let me know what I should do next I would be more than happy to submit PRs to improve the relevant error message and associated docs. 😄

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS Mojave 10.14.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz
  Binaries:
    Node: 11.12.0 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions