We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
msw
https://stackblitz.com/~/github.com/rinux55/nuxt-fetch
See app.test.ts. In the test/setup.ts and test/server.ts there is an msw server being set up with a mocked endpoint.
app.test.ts
test/setup.ts
test/server.ts
To mock requests made using $fetch and useFetch, I expect to be able to use a utility like msw.
$fetch
useFetch
Unfortunately, this doesn't seem to work in combination with @nuxt/test-utils.
@nuxt/test-utils
I've created a reproduction where you can see that globalThis.fetch is mocked just fine, but useFetch or fetch is not:
globalThis.fetch
fetch
Any help with this would be greatly appreciated.
No response
The text was updated successfully, but these errors were encountered:
Linking unjs/ofetch#295 here as well
Sorry, something went wrong.
As a workaround you can try to use registerEndpoint function.
registerEndpoint
No branches or pull requests
Environment
Reproduction
https://stackblitz.com/~/github.com/rinux55/nuxt-fetch
See
app.test.ts
. In thetest/setup.ts
andtest/server.ts
there is anmsw
server being set up with a mocked endpoint.Describe the bug
To mock requests made using
$fetch
anduseFetch
, I expect to be able to use a utility likemsw
.Unfortunately, this doesn't seem to work in combination with
@nuxt/test-utils
.I've created a reproduction where you can see that
globalThis.fetch
is mocked just fine, butuseFetch
orfetch
is not:https://stackblitz.com/~/github.com/rinux55/nuxt-fetch
Any help with this would be greatly appreciated.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: