-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
vi.unmock
does not unmock imitated module
#2351
Labels
Comments
This should have „in“ check, because mocks without factory are stored as „null“: vitest/packages/vitest/src/runtime/mocker.ts Line 294 in 2499828
PR welcome |
Fixed by #2353 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
When mocking modules using
vi.mock
(orvi.doMock
), if the module is replaced implicitly, a subsequent call tovi.unmock
(orvi.doUnmock
) will not unmock the module.I believe this to be a bug, because if you provide an explicit replacement via the second argument to
vi.mock
, instead of relying on the module imitation logic, the call tounmock
will successfully remove the mock.Reproduction
See mcous/vitest-unmock-bug
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: