From 11a51b1f64099644ceb19caece1d6de0e0975156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20BALLI?= Date: Mon, 22 Jan 2024 13:00:02 +0100 Subject: [PATCH] Update jest-missing-globals.mdx ReadableStream also have to be added in order this solution to work In this discussion it is written clearly https://github.com/mswjs/msw/discussions/1934#discussioncomment-7874204 --- src/content/docs/shared/jest-missing-globals.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/content/docs/shared/jest-missing-globals.mdx b/src/content/docs/shared/jest-missing-globals.mdx index b8000ddc..cc5e2bdb 100644 --- a/src/content/docs/shared/jest-missing-globals.mdx +++ b/src/content/docs/shared/jest-missing-globals.mdx @@ -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") Object.defineProperties(globalThis, { TextDecoder: { value: TextDecoder }, TextEncoder: { value: TextEncoder }, + ReadableStream: { value: ReadableStream }, }) -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") Object.defineProperties(globalThis, { fetch: { value: fetch, writable: true },