boostcamp-challenge
[jest] javascript es6+ npm test 와 node를 같이 쓰기
blopz
2024. 8. 2. 14:09
jest 설치
> npm i -D jest 로 jest를 설치해주고
package.json
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
},
"type" : "module"
package.json에 해당 단락을 추가해 jest로 test하도록 한다.
여기서 "test": "jest" 를 사용하는 대신 "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js" 를 사용하면 "type" : "module" 을 사용면서 node 명령어와 npm test 명령어가 동시에 먹는다!
[7/23] JEST: Test 라이브러리는 이렇게 섹시하구나
라이브러리 정하기Jest 이전에는 자바스크립트 코드를 테스트하라면 여러가지 테스팅 라이브러리를 조합해서 사용하곤 했었다.예를 들어, Mocha나 Jasmin을 Test Runner로 사용하고, Chai나 Expect와 같은
blopz.tistory.com
How to resolve "Cannot use import statement outside a module" from Jest when running tests?
I have a React application (not using Create React App) built using TypeScript, Jest, Webpack, and Babel. When trying to run yarn jest, I get the following error: I have tried removing all package...
stackoverflow.com
처럼 babel을 사용안해도 된다...