You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While we can configure "mockReset" in the vitest config, or explicitly call "mockRest" in the "beforeEach", this also blows away other mocks that may have been configured.
It would be great if we could have a new spyReset to only reset spies. Right now we have a number of tests verifying a spy was called N times, and explicitly cleaning up each spy manually using onTestFinished callback is klunky at best.
Suggested solution
Create new spyReset that can be configured in vitest config, or called manually, to only reset spyOn spies instead of all mocks.
Clear and concise description of the problem
With the new 3.0 release, "vi.spyOn Reuses Mock if Method is Already Mocked" is a breaking change without a simple migration strategy.
While we can configure "mockReset" in the vitest config, or explicitly call "mockRest" in the "beforeEach", this also blows away other mocks that may have been configured.
It would be great if we could have a new
spyReset
to only reset spies. Right now we have a number of tests verifying a spy was called N times, and explicitly cleaning up each spy manually usingonTestFinished
callback is klunky at best.Suggested solution
Create new
spyReset
that can be configured in vitest config, or called manually, to only resetspyOn
spies instead of all mocks.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: