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
I tried using stackblitz but for some reason an error is thrown from the vitest setup file when importing from msw.
Describe the bug
I'm trying to test a vue component that renders some data fetched from a mocked API endpoint using Mock Service Worker. I have a vitest setup file which creates the msw server with a default handler. Inside the tests I'm overriding the default handler following the steps described here.
I have two test files, one using the default test environment (happy-dom, set in vitest.config.ts) and another using the nuxt environment.
When running the test that uses happy-dom environment the component renders the data from the handler that overrides the default one and it passes.
When running the test that uses nuxt environment it fails because the component renders the data from the default handler, even though the handler is overridden at the top of the test just like in the passing test.
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered:
Environment
Windows_NT
v22.14.0
3.16.1
3.23.1
2.11.8
[email protected]
-
compatibilityDate
,devtools
,ssr
-
-
Reproduction
https://github.com/AlexanderForm1/nuxt-msw-override
Run
npx vitest
I tried using stackblitz but for some reason an error is thrown from the vitest setup file when importing from
msw
.Describe the bug
I'm trying to test a vue component that renders some data fetched from a mocked API endpoint using Mock Service Worker. I have a vitest setup file which creates the msw server with a default handler. Inside the tests I'm overriding the default handler following the steps described here.
I have two test files, one using the default test environment (
happy-dom
, set invitest.config.ts
) and another using thenuxt
environment.When running the test that uses
happy-dom
environment the component renders the data from the handler that overrides the default one and it passes.When running the test that uses
nuxt
environment it fails because the component renders the data from the default handler, even though the handler is overridden at the top of the test just like in the passing test.Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: