-
-
Notifications
You must be signed in to change notification settings - Fork 478
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
[0.19.5] Docs and example now error regarding use of setupWorker in Node #245
Comments
Thanks for reporting this, @wKovacs64! Yes, you're right, it's a matter of separating those modules so they don't intersect. |
Thank you for the changes to the REST example! The build passes, which means example is functional. |
That fixed the example, but I think the docs still lead you down the path that will trigger this error. Not sure if/how you want to update them? |
Are you speaking about the new documentation? I believe it separates the handlers/browser/server exactly as we had in the examples.
|
I was referring to the new docs, yes. For example, the "Getting Started > Defining mocks" section begins with creating |
You are completely right 🤦 I didn't realize it suggests integration in the same |
Cool, glad I wasn't imagining that. 😄 |
That's definitely a valid concern. I've opened an issue in the docs about that: mswjs/mswjs.io#9 |
I've updated the "Getting stared" tutorial to recommend the proper file structure. Thanks once more for bringing this up. |
Describe the bug
Not really a bug, just a discrepancy between the documentation/example and the behavior in the latest release. #219 throws an error when you try to use
setupWorker
in Node (e.g. Jest tests), but the documentation and therest-react
example both call it directly in the mocks file, so you can't use that same file in the browser and Node-based tests.Environment
msw: 0.19.5
nodejs: 12.18.1
npm: 6.14.5
Browser: N/A
To Reproduce
Steps to reproduce the behavior:
rest-react
examplenpm run test:unit
Expected behavior
I expected the example to work and the steps in the documentation to produce a working structure.
Possible solutions
Is it just a matter of restructuring the docs/example to match the
graphql-react-apollo
example where the handlers are separate from thesetupWorker
/setupServer
calls?The text was updated successfully, but these errors were encountered: