You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running tests using enzyme in CRA app, the following error occurred:
Test suite failed to run
ReferenceError: TextEncoder is not defined
> 1 | import { configure } from 'enzyme';
| ^
at Object.<anonymous> (node_modules/undici/lib/web/fetch/data-url.js:5:17)
at Object.<anonymous> (node_modules/undici/lib/web/fetch/util.js:7:97)
at Object.<anonymous> (node_modules/undici/lib/web/fetch/headers.js:11:5)
at Object.<anonymous> (node_modules/undici/lib/web/fetch/response.js:3:90)
at Object.<anonymous> (node_modules/undici/lib/web/fetch/index.js:11:5)
at Object.<anonymous> (node_modules/undici/index.js:106:19)
at Object.<anonymous> (node_modules/cheerio/src/index.ts:24:1)
at Object.<anonymous> (node_modules/enzyme/src/Utils.js:9:1)
at Object.<anonymous> (node_modules/enzyme/src/ReactWrapper.js:4:1)
at Object.<anonymous> (node_modules/enzyme/src/index.js:1:1)
at Object.<anonymous> (src/setupTests.js:1:1)
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
Your repository uses https://github.com/wojtekmaj/enzyme-adapter-react-17, which is archived and not maintained anymore. My guess is that old module does not support those globals (TextDecoder). I would recommend to update your dependencies.
Bug Description
When running tests using
enzyme
in CRA app, the following error occurred:Reproducible By
See https://github.com/jimmyzhen/undici-code-example
Expected Behavior
The same tests didn't break when I ran them in my environment last week, and
undici v7.1.0
appears to just be just released couple of days ago.Logs & Screenshots
Environment
node
20.11.0
enzyme
3.11.0
Additional context
The text was updated successfully, but these errors were encountered: