-
Notifications
You must be signed in to change notification settings - Fork 711
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
example-intro page provides an example using msw, which does not work with jest out of the box #1367
Comments
Hi, @skondrashov. I think a link to here in the RTL example page would be useful. Something like: Note that you need additional configuration for Jest in order to use it with the global Fetch API (). I would also love to see that example just mentioning Vitest, which eliminates the need for any kind of fixes. |
That doc does not include a ReadableStream polyfill (and possibly other polyfills if I get that one to work), which I've found that you've created a package for, but a link to that document is not sufficient to get the example working. EDIT: |
If anyone finds themselves here in search of usable docs, they can be found here: https://github.com/testing-library/testing-library-docs/blob/cb41b06ed6cf01d9f894262f1cd58adbb0d2dbfc/docs/react-testing-library/example-intro.md |
Polyfilling |
I've been working on setting up tests in a project for a few days now, and I am genuinely confused how people have been setting up RTL using the docs for the last 3 or 4 years since msw replaced the mocking examples that were previously in the docs. The docs explicitly recommend jest, msw explicitly does not work with jsdom, which is required to run tests with jest. How have people been able to use the docs for the last several years? I feel like I'm missing something huge since I don't see a flood of other developers leaving similar issues and comments, but what is the recommended thing to do? Should I abandon jest like @kettanaito recommends, and can the docs reflect that if so? Can the docs include the required polyfills if everyone is just stackoverflowing their way through it like I've been trying to?
The text was updated successfully, but these errors were encountered: