-
-
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
Automatic restore for spyOn #2972
Comments
Similar issue was discussed here: #2965. |
Would you also accept a PR to the docs to clear up the difference between clear/reset mocks? We've got very confused between clearMocks and resetMocks. My understanding is:
Is that correct? If that is correct, it feels like |
@jackfranklin docs PRs are always welcome! |
@thymikee OK, I'll get one in ;) Are my definitions of clear/reset mocks correct in the comment above? |
I don't like the naming either. The definitions seems ok 👍 |
@thymikee given we have |
Feel free to open a separate issue just for that, so we can discuss. |
Looks like this feature's been in the codebase since #3580 was merged last year. May be worth closing. |
@geoffreyyip yup, thanks, docs are here |
As already mentioned in #1749, could
spyOn
have automatic restore as jasmine has?It would help to isolate spies for given test, as its simple to forget to call the restore at the end of the test (and can affect the other tests which is always difficult to track down).
And also there is no guarantee that the restore will get called, because test might fail in some
expect
, which stops the execution of the test and prevents calling the restore, which is usually called at the end of the test function.The text was updated successfully, but these errors were encountered: