yarn add --dev @babel/core @babel/preset-env
testEnvironment
의 기본값은 node
로, Node.js 환경에서 테스트jsdom
으로 설정하여 유사 브라우저 환경에서 테스트할 수 있다.module.exports = {
testEnvironment: 'jsdom',
};
기본적으로 Jest는
__tests__
디렉토리 하위의.js
,.jsx
,.ts
,.tsx
파일과 경로에 상관없이.test
,.spec
(예:Component.test.js
,Component.spec.js
) 파일을 테스트 파일로 간주한다. (test.js
,spec.js
파일 포함)
https://jestjs.io/docs/configuration#testmatch-arraystring
module.exports = {
presets: ['@babel/preset-env'],
};