-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout - Async callback was not invoked within the 5000ms timeout not showing where it failed #9881
Comments
For anyone experiencing the same issue with jest puppeteer tests, I found a workaround to make the failure message display the line where it's timing out:
Now, my failure message looks like this:
Note, the timeout duration inside the test has to be a shorter than the global timeout, otherwise it has no effect. Edit: Caveat - this seems to work for page.waitForSelector but not page.goto in my experience |
Just put setTimeout (function () {}, 5000) around in the code, this solved my problem |
@fernanndosenna , can you give an example? I am not sure how I would use it. |
Does anyone know if there's been any progress resolving this issue? We're hitting timeouts in some React Testing Library tests and it would be really nice to be able to see how far we got before the tests timed out. @SimenB if you're able to point me in the right direction, I'm interested in taking a swing at fixing this. I just need to know where to start. (Also, long time no see @SimenB! 👋 Glad to see Jest still has you on the team. 👌 Hope you're doing well.) |
Jest cannot know which We could at some point add proper tracking to e.g. Either way, this is not a bug, simply the way JavaScript works. Feel free to open a feature request for tracking Workaround would be to add timeouts to your own promises, like the puppeteer example in #9881 (comment) - but note that this is a promise that rejects after a timeout, it's not hanging indefinitely. I thought RTL already did something similar (timing out a bit lower than Jest's timeout), but that probably falls apart if there are multiple |
Got it. That makes sense. So, is the plan in #9881 to wire up an inspector so that folks can use it to profile the test to see where the time is being spent in the test? |
If you mean #9785, then the plan would be for Jest to point to last where a promise never resolved, like it would point to where an infinite loop happens 🙂 I'd suggest increasing test timeout and reducing (or adding if missing) a timeout to promises created |
Sounds great. Thanks Simen! 🙂 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Jest is not showing which on which line the timeout is happening.
To Reproduce
https://repl.it/@evandrocoan/AttractiveShabbyBusinesses
Actual behavior
Expected behavior
envinfo
Related:
The text was updated successfully, but these errors were encountered: