Skip to content

Agriculture-Intelligence/msw-vitest-browser-issue

Repository files navigation

Vitest Browser + MSW

Mock Service Worker usage example with Vitest in browser mode.

When the vitest environment is setup with ANY vi.mock calls, it appears to disrupt the expected functionality of the worker, leading to intercepted calls not being properly mocked. Notice how the downloadData method will fail with [ERROR] 18:46.980 xhr-http-handler - Network Error when the vi.mock call is present, but will work as expected when it is removed.