-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Bug]: Failed toEqual
assertion has some sort of side-effect that causes toEqual using the same value in subsequent tests to fail incorrectly (Jest 29+ only)
#15046
Comments
Just a note so I'm not cluttering the report, I tried spending some time to re-create this without using Luxon, but it's a complex library, so without knowing anything about the internals of Jest, I can't figure out what exactly might be causing this behaviour. |
toEqual
assertion has some sort of side-effect that causes toEqual using the same value in subsequent tests to fail (Jest >= 29 only)toEqual
assertion has some sort of side-effect that causes toEqual using the same value in subsequent tests to fail incorrectly (Jest >= 29 only)
toEqual
assertion has some sort of side-effect that causes toEqual using the same value in subsequent tests to fail incorrectly (Jest >= 29 only)toEqual
assertion has some sort of side-effect that causes toEqual using the same value in subsequent tests to fail incorrectly (Jest 29+ only)
For me it does not reproduce with Jest 29.0.0. Bisecting points to #14007 as the first bad commit, which shipped with Jest 29.6.0. Very likely this is the culprit, because the issue is reproducing with Jest 29.6.0 and up. |
That's odd. I just triple checked and it's definitely working for me on 28.1.3, but not 29.0.0 (I also reproduced on 29.0.0-alpha.0) |
You don’t have to close. This is a bug. While reproducing I was running the test you provided in Jest repo. All works as expected, if |
Yes sorry, that's just me having a bad morning and clicking the wrong button! |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Version
29.7.0
Steps to reproduce
npm i
npm run test
Expected behavior
There should be exactly one test failure (the second test case) containing the failed expectation. The third test should pass as it is identical to the first.
Actual behavior
After the failed expectation involving the shared
DateTime
, subsequent tests fail as if it has been mutated.Additional context
Luxon is an immutable date time library, all modifications yield new objects, so it shouldn't be possible for this error to occur. I don't believe this is a fault with Luxon as the behaviour only occurs with Jest
29.0.0
and upwards.Some observations:
Environment
The text was updated successfully, but these errors were encountered: