-
Notifications
You must be signed in to change notification settings - Fork 1
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: add readme, instructions and explanation #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
README.md
Outdated
|
||
## Motivation | ||
|
||
Jest strips out a number of NodeJS globals that are used in tests and libraries involving JSDOM, such as structuredClone, ReadableStream, and so on. This library patches these globals back in - there is no polyfilling or mocking involved, it simply re-attaches the missing globals to the JSDOM environment. If you've ever come across errors such as `ReferenceError: ReadableStream is not defined` or `ReferenceError: structuredClone is not defined`, this library is for you. If you were previously using (undici)[https://www.npmjs.com/package/undici] purely to solve this, you will no longer need it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not entirely correct. There are a few things that happen in the Jest/JSDOM combo:
- Some globals are stripped away, like
ReadableSteam
,TextEncoder
,TextDecoder
. - Some globals are present but are polyfilled by JSDOM or other libraries, making them incompatible with Node.js, e.g.
Event
andstructuredClone()
.
If you want, I can help you rewrite this section. Let me know.
README.md
Outdated
|
||
You will need to add/modify two properties in your jest configuration to use jest-fixed-jsdom. | ||
|
||
```json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to add a comment that mentions what file this is (jest.config.js
).
5dd1c3f
to
6ba5b76
Compare
6ba5b76
to
c71d538
Compare
I've polished the readme a bit. Thank you for your work on this, @JamesZoft @tobiashochguertel! 👏 |
No description provided.