-
-
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
[Bug]: mockReset restoring mocks instead of resetting them #13916
Comments
The fix appears to be writing an equivalent of #13866 for |
The behaviour is correct. Try using Documentation of After being reset the With |
Verified that mockFn.mockReset() should reset mock to it's initial state.
|
Looks like this issue was reported as a feature request in #13229 |
Reopening as @shlomo-artlist had commented on how this is a breaking change, and how it makes |
When I searched for differences between |
I'd like to second that
We've been using Unfortunately, I can't provide a minimal reproducible example yet. If we will be able to identify the exact problem, I'll post an update here. I'm making this comment just to see if others have similar issues. Also, this comment might be related, since replit example from it also doesn't work with version PS. Both of the above changes are announced as "fixes", so maybe we were relying on a bug in our setup for 5 major versions of jest 😅. Still it does not sound like it should be a patch-version update. |
The #5143 (comment) which you mentioned is now somewhat outdated. Since Jest v29.4.0 first answer should read:
Reference #13692 If your CIs are public, I can take a look. Minimal reproduction is always welcome too. |
Thank you so much for your quick reply @mrazauskas! This information is helpful. Unfortunately, the CI is not public. I'll post an update as soon as we figure out something. |
Echoing @dhampik, 300+ of our tests started failing with this update, all with the same pattern of error:
I'm still trying to trace down why, so I don't have a minimal repro yet, nor are our tests public, but just wanted to add another data point here that something is fishy with the changes in this release. |
The |
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. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
Version
29.4.3
Steps to reproduce
Simple test to repro:
Expected behavior
The test should pass where
module.api()
is reset to undefined in both the spyOn and overwrite cases.Actual behavior
The test fails in spyOn case.
Additional context
The fix for resetAllMocks from #13808 should be applied to mockReset too?
Environment
The text was updated successfully, but these errors were encountered: