You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, an error thrown in setTimeout interrupts the resolve(1) of the promise, so the promise will stay in <pending> state. However, I guess this "unwanted" error is expected to be presented to the user in some way.
Actual behavior
The error "disappears", without any hint on its existence. JEST simply stucks at running the test case (since the promise is never resolved), and ends after the default timeout is hit, and exits without any further information.
It's not possible in JS to inspect that state of a promise from the outside. It's up to your own code to make sure to properly resolve or reject any promise you return to Jest. The only thing Jest can do is time out.
In this case (I realize it's example code), wrap the content of the timeout in try-catch.
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
27.5.1
Steps to reproduce
Expected behavior
In this case, an error thrown in
setTimeout
interrupts theresolve(1)
of the promise, so the promise will stay in<pending>
state. However, I guess this "unwanted" error is expected to be presented to the user in some way.Actual behavior
The error "disappears", without any hint on its existence. JEST simply stucks at running the test case (since the promise is never resolved), and ends after the default timeout is hit, and exits without any further information.
Additional context
No response
Environment
System: OS: Linux undefined CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.10 - /bin/yarn npm: 7.17.0 - /bin/npm npmPackages: jest: ^27.5.1 => 27.5.1
The text was updated successfully, but these errors were encountered: