Testing with jest and jest-environment-jsdom using undici - error: ReferenceError: ReadableStream is not defined #1925
Unanswered
Roman-e-prog
asked this question in
Q&A
Replies: 2 comments 1 reply
-
I think there's a change in unidic v6 that we haven't dug into yet, try with v5 instead and let us know if that doesn't help? |
Beta Was this translation helpful? Give feedback.
1 reply
-
const { TextDecoder, TextEncoder, ReadableStream } = require("node:util"); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have installed msw 2.0.2 into a next.js 13.4.10 project that will be tested with jest. I had several errors and followed the instructions from the msw docs. There I was told to build a jest.polyfills.js in the root of the project and that I should install undici. This I have done and coppied the code from the docs. Now I have this error when running a jest test. ReadableStream is not defined. I am not familiar with this undici library, not used polyfills until yet and just starting with msw. So I not know how I should deal with this. I don't want to build a custom test environment. Adding ReadableStream to the polyfill like this not worked:
Is there another solution from msw? Perhaps someone can advice me?
Current error:
Test suite failed to run
Beta Was this translation helpful? Give feedback.
All reactions