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
During actual execution, the value of the second useUserStore2 is always the content of the first useUserStore1.
To my knowledge, even without using doUnmock or resetModules, doMock should be able to override the previous mock content. However, regardless of whether I use vi.resetModules(); vi.doUnmock("../../stores/userStore"); in beforeEach, the doMock in the second test cannot effectively override the content of the doMock in the first test.
Reproduction
Running guards.test.ts from this code reproduces this result mjga-dashboard.zip
This doesn't work because resetModules doesn't work in the browser at the moment.
Thank you. However, is doUnmock currently unavailable as well?
Additionally, as far as I know, even though doMock's default behavior overwrites the previous behavior (as mentioned in this issue), theoretically, this test should still work without using resetModules.
Browser mocking and Node.js mocking have completely different implementations. At the moment, browser mocking doesn't support subsequent mocks for the same reason it doesn't support resetModules - the cache is not invalidated.
Browser mocking and Node.js mocking have completely different implementations. At the moment, browser mocking doesn't support subsequent mocks for the same reason it doesn't support resetModules - the cache is not invalidated.
I see. It looks like there's still a long way to go before I'll be able to use mock in browser mode, so I'm going to hold off on writing unit tests for a while until browser mode has perfected sub-sequent mock.
Describe the bug
During actual execution, the value of the second
useUserStore2
is always the content of the firstuseUserStore1
.To my knowledge, even without using
doUnmock
orresetModules
,doMock
should be able to override the previous mock content. However, regardless of whether I usevi.resetModules(); vi.doUnmock("../../stores/userStore");
inbeforeEach
, thedoMock
in the second test cannot effectively override the content of thedoMock
in the first test.Reproduction
Running
guards.test.ts
from this code reproduces this resultmjga-dashboard.zip
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: