Closed ezzatron closed 1 day ago
msw/browser
cannot be mocked anymore because Vitest uses it for vi.mock
. The only thing you can do is use aliases to redirect it to another file.
Thanks, I was able to fix my test suite with aliases. For anyone else running into the same issue, this was how I fixed it: https://github.com/ezzatron/isomorphic-msw/commit/b6d2d52346a410debd632539768244c1f0b52e79
Describe the bug
Under Vitest 2.1.4, mocking the
msw/browser
module viavi.mock()
no longer works. It works fine under Vitest 2.1.3.Reproduction
Please see https://github.com/ezzatron/vitest-browser-mode-mock-msw-browser-repro
GitHub Actions workflow run showing the regression: https://github.com/ezzatron/vitest-browser-mode-mock-msw-browser-repro/actions/runs/11946013042
Sample output under Vitest 2.1.3:
Sample output under Vitest 2.1.4:
System Info
Used Package Manager
npm
Validations