-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
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
Mocking with react-query and graphql-request stopped working after upgrade to the LTS version of msw #2009
Comments
Hi, @zgrybus. Thanks for reporting this. There are a couple of problems with the way you configured Jest. I will go through them below. Problem 2: Using
|
Hey @kettanaito - the problem remains for me for |
It turns out, when I am testing this Browser app in a node jsdom environment, this gets intercepted by MSW: fetch("/graphql") but this` import request from 'graphql-request`
request("/graphql", gql`query Test {id}`) throws an error:
and hence never arrives at MSW. I guess this is a |
@MoSattler You may change the URL, when
That should work :) Moreover, @MoSattler |
Prerequisites
Environment check
msw
versionNode.js version
20.10.0
Reproduction repository
https://codesandbox.io/p/devbox/msw-nextjs-react-query-z6n3h8?file=%2Fcomponents%2FTodoList.spec.tsx%3A18%2C61
Reproduction steps
npm run test
Current behavior
Mocking the
graphql-request
stopped working. There are no 3 items of list that we have mocked intests/mocks/handlers.ts
Expected behavior
We should get 3 items in a todo list
The text was updated successfully, but these errors were encountered: