How to restore original implementation and continue syping on a method? #6308
Unanswered
Lordfirespeed
asked this question in
Q&A
Replies: 2 comments 8 replies
-
If you want others to help, you should probably provide some code so it is easier to understand what you mean. |
Beta Was this translation helpful? Give feedback.
1 reply
-
You cannot do that without losing the spy assignment, you need to re-apply the spy again. This is done to be compatible with Jest. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Title. #3386 is relevant
mockClear
doesn't affect implementationmockReset
restores an empty implementation (not the original)mockRestore
stops spyingexample:
The first test succeeds, but the second test fails as
restoreAllMocks
un-spiesfoo.bar
.How can I restore original implementations after each test, without un-spying?
Beta Was this translation helpful? Give feedback.
All reactions