Latest version 7.1.0
appears to break tests using enzyme
#3927
Open
Description
Bug Description
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)
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