Skip to content
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

mockReset doesn't work well with calledWith #22

Closed
regevbr opened this issue Mar 31, 2020 · 1 comment · Fixed by #24
Closed

mockReset doesn't work well with calledWith #22

regevbr opened this issue Mar 31, 2020 · 1 comment · Fixed by #24

Comments

@regevbr
Copy link
Contributor

regevbr commented Mar 31, 2020

When performing mockReset, the jest.fn() method is being reset which is great, but the inner state of the calledWith scope is maintained, thus the jest.fn() is not called again with mockImplementation and the call stack just gets piled up

@regevbr regevbr changed the title mockReset doesn't clear the call stack of calledWithFn mockReset doesn't work well with calledWith Mar 31, 2020
@regevbr
Copy link
Contributor Author

regevbr commented Mar 31, 2020

the fix is pretty easy, we need to check if the jest.fn() has an implementation, and if not, mock it and reset the stack. PR is coming soon

regevbr added a commit to regevbr/jest-mock-extended that referenced this issue Mar 31, 2020
regevbr added a commit to regevbr/jest-mock-extended that referenced this issue Mar 31, 2020
regevbr added a commit to regevbr/jest-mock-extended that referenced this issue Apr 2, 2020
regevbr added a commit to regevbr/jest-mock-extended that referenced this issue Apr 3, 2020
regevbr added a commit to regevbr/jest-mock-extended that referenced this issue Jun 11, 2020
marchaos added a commit that referenced this issue Jun 11, 2020
bug: mockReset doesn't work well with calledWith #22
Beraliv pushed a commit to Beraliv/jest-mock-extended that referenced this issue May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant