-
-
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
Cannot read property 'addExpectationResult' of undefined #5922
Comments
Can you set up a repo we can pull down and see the error in? |
I will see what I can do. I'm quite swamped at work right now. I attempted to created a small repro, but could not reproduce it. In a month I will definitely have the time to do it. In the mean time I'll just use v20. |
Ah ok, @adrianhelvik please re-open when you have a chance to create repro repo and I'm happy to take a look |
FWIW I also ran into this and was led to this issue. Only happened in CI when an async test timed out but the underlying action continued until after the test suite finished (and I'm guessing the callback tried to add the result of the expectation). I could never get it to happen locally though. |
@patrickhulce were you able to fix this? I have the exact same behavior as you do. It doesn't happen on locally. Only on my Jenkins CI server. |
@chris-fa only by fixing my failing test :) I was unsuccessful in creating a local repro for ya sorry! |
@chris-fa I have the same issue. On local machines all test pass, but on our Virtual Machine some test cases fail with |
this is fixed here #6794 |
@sibelius Tried it, by did not work. In the end updating NodeJS from 8.9.4 to 9.11.2 fixed it. Strange... |
I just ran into this as well in 23
|
Sorry to comment on closed issuer, but this still happens if a long running call throws an error after the |
@malixsys : Did you got any solution for the issue. I'm using jest 23.6.0 and I'm also getting the same issue. |
Added a more explicit error in #8005. |
@SimenB : As you mentioned "bah, node 6 and 8 doesn't have finally", if that is the root cause of the issue then the weird thing is, I've two repositories running in same jenkins server. |
That was just part of the changes in my PR, not related to any issue you're seeing. |
@indranilatwork Just needed to go back and make sure that the test does not end before the callback... |
@malixsys : The unit tests works fine for me in my local but not running in my jenkins server, it fails with the error: (node:7109) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6) (node:7109) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:7109) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'addExpectationResult' of undefined (node:7109) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7) (node:7109) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'addExpectationResult' of undefined (node:7109) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8) As I checked my unit test code, not seeing the callbacks are out of the test cases. I'm using jest 23.6.0 |
@indranilatwork These errors happen because your test is finished and THEN later some callback returns in your test code with an unhandled error... Make sure the failing test returns all promises in your Your component should show that it is waiting for a call and your test should look for that sign to go away... We use something like:
|
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. |
Do you want to request a feature or report a bug?
A bug
What is the current behavior?
In Jest 20, everything works fine. In Jest 21/22 I get this behavior. It happens on all computers I have attempted to test this project on. I have tried to remove node_modules and yarn.lock.
The tests run and fail and then this error is thrown in jest 22.
In Jest 21, this error is thrown:
The tests run with
jest --runInBand --watch
as they test database procedures. When I remove--watch
, the error disappears, but the tests do not seem to run in sequence as they still fail.A typical test file looks something like this:
What is the expected behavior?
Tests should run normally and no error should occur.
Please provide your exact Jest configuration
Run
npx envinfo --preset jest
in your project directory and paste theresults here
The text was updated successfully, but these errors were encountered: