**Request
/Response
/TextEncoder
is not defined (Jest)
Node.js 글로벌이 없어서 발생**
jest-environment-jsdom
내장 API를 폴리필로 의도적으로 대체하여 Node.js 호환성을 깨기 때문에 사용할 때 발생
// jest.config.js
module.exports = {
testEnvironment: 'jest-fixed-jsdom',
}
// jest.config.js
module.exports = {
testEnvironmentOptions: {
customExportConditions: [''],
},
}
JSDOM이 기본적으로 내보내기 조건을 사용하기 때문에 테스트 러너에서 발생합니다 browser
. 즉, MSW와 같은 타사 패키지를 가져올 때 JSDOM은 내보내기를 browser
진입점으로 사용하도록 강제
https://mswjs.io/docs/migrations/1.x-to-2.x#requestresponsetextencoder-is-not-defined-jest