Но теперь попытка создать файл конфигурации Jest30+JSDOD30, который делает так же, как: < /p>
Код: Выделить всё
module.exports = {
testEnvironment: 'jsdom',
setupFiles: [
'/.jest/setup.js',
]
}
< /code>
// .jest/setup.js
import { JSDOM } from 'jsdom'
< /code>
бросит < /p>
● Test suite failed to run
ReferenceError: TextEncoder is not defined
1 | import { JSDOM } from 'jsdom'
2 |
at Object. (node_modules/whatwg-url/lib/encoding.js:2:21)
at Object. (node_modules/whatwg-url/lib/url-state-machine.js:5:34)
at Object. (node_modules/whatwg-url/lib/URL-impl.js:2:13)
at Object. (node_modules/whatwg-url/lib/URL.js:499:14)
at Object. (node_modules/whatwg-url/webidl2js-wrapper.js:3:13)
at Object. (node_modules/whatwg-url/index.js:3:34)
at Object. (node_modules/jsdom/lib/api.js:7:19)
at Object. (.jest/setup.js:3:14)
Код: Выделить всё
import { TextEncoder, TextDecoder } from 'util';
Подробнее здесь: https://stackoverflow.com/questions/797 ... ot-defined
Мобильная версия