-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Update jest-missing-globals.mdx #353
Conversation
ReadableStream also have to be added in order this solution to work In this discussion it is written clearly mswjs/msw#1934 (comment)
@barisbll is attempting to deploy a commit to the MSW Team on Vercel. A member of the Team first needs to authorize it. |
@@ -24,15 +24,16 @@ Create a `jest.polyfills.js` file next to your `jest.config.js` with the followi | |||
* you don't want to deal with this. | |||
*/ | |||
|
|||
const { TextDecoder, TextEncoder } = require('node:util') | |||
const { TextDecoder, TextEncoder, ReadableStream } = require("node:util") |
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.
I think we should keep quotes as they are
const { TextDecoder, TextEncoder, ReadableStream } = require("node:util") | |
const { TextDecoder, TextEncoder, ReadableStream } = require('node:util') |
const { Blob, File } = require("node:buffer") | ||
const { fetch, Headers, FormData, Request, Response } = require("undici") |
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.
const { Blob, File } = require("node:buffer") | |
const { fetch, Headers, FormData, Request, Response } = require("undici") | |
const { Blob, File } = require('node:buffer') | |
const { fetch, Headers, FormData, Request, Response } = require('undici') |
@@ -24,15 +24,16 @@ Create a `jest.polyfills.js` file next to your `jest.config.js` with the followi | |||
* you don't want to deal with this. | |||
*/ | |||
|
|||
const { TextDecoder, TextEncoder } = require('node:util') | |||
const { TextDecoder, TextEncoder, ReadableStream } = require("node:util") |
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 incorrect though. Must be imported from node:stream/web
. That's the correct implementation of web's ReadableStream
. We've already had issues with people trying to polyfill the stream from node:utils
and it fails.
There's also a fundamental problem of polyfilling See more details here: mswjs/msw#1916 (comment). This is why recommending polyfilling |
Fixed by #419. |
ReadableStream also have to be added in order this solution to work
In this discussion it is written clearly mswjs/msw#1934 (comment)