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

Rename restoreAllMocks to restoreAllSpies #7757

Closed
Farwatch opened this issue Jan 30, 2019 · 6 comments
Closed

Rename restoreAllMocks to restoreAllSpies #7757

Farwatch opened this issue Jan 30, 2019 · 6 comments

Comments

@Farwatch
Copy link

🚀 Feature Proposal

Rename restoreAllMocks to restoreAllSpies.

Motivation

As stated in the docs here, the restoreAllMocks function only restores mocks created with spyOn. This leads to confusion for newer users.

Example

afterEach(jest.restoreAllSpies)

Notes

For backwards compatibility, I would expect restoreAllMocks to be aliased to restoreAllSpies, deprecated, and then removed in a future version.

@Farwatch
Copy link
Author

Farwatch commented Feb 1, 2019

On a similar note, add the config option of restoreSpies to mirror the restoreMocks option, as this makes the naming consistent.

@SimenB
Copy link
Member

SimenB commented Feb 1, 2019

Yeah, good call! Can you add it as a comment to #7185 please?

@Farwatch
Copy link
Author

Farwatch commented Feb 1, 2019

I'm currently looking into implementing this and raising a PR. Do you want it tagged against #7185 ?

@SimenB
Copy link
Member

SimenB commented Feb 1, 2019

Thanks! This would be a breaking change, so we won't do this until later (it'll land as part of Jest 25). We could support both at the same time, but that's kinda meh. Thanks for the offer, though! And please don't hesitate to provide more feedback on other config options.

@Farwatch
Copy link
Author

Farwatch commented Feb 1, 2019

Ah fair enough, sounds like the right move. Cheers for quick responses 👍

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants