Skip to content
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

docs: Upate React example usage with MSW to mention that fetch will require polyfill #1418

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dwjohnston
Copy link
Contributor

Updates the example notes re: MSW to mention that jsdom doesn't include fetch and will require a polyfill

Updates the example notes re: MSW to mention that jsdom doesn't include fetch and will require a polyfill
Copy link

netlify bot commented Aug 30, 2024

Deploy Preview for testing-library ready!

Name Link
🔨 Latest commit 69b1122
🔍 Latest deploy log https://app.netlify.com/sites/testing-library/deploys/66d955f5e7327000083853d3
😎 Deploy Preview https://deploy-preview-1418--testing-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -72,6 +72,8 @@ We recommend using the
declaratively mock API communication in your tests instead of stubbing
`window.fetch`, or relying on third-party adapters.

Our example here uses axios to make its API calls. If your application uses [`fetch()`][https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch] to make its API calls, then be aware that by default JSDOM does not include fetch. If you are using vitest as your test runner, it will be included for you. For jest you may wish to manually polyfill `fetch()` or use the [jest-fixed-jsdom](https://github.com/mswjs/jest-fixed-jsdom) environment which includes fetch.
Copy link
Member

@MatanBobi MatanBobi Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Any chance you can please add the note admonition here around this?

:::note

:::

@dwjohnston dwjohnston changed the title Update example-intro.mdx docs: Upate React example usage with MSW to mention that fetch will require polyfill Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants