Documenting my learning journey of Namaste React Live Course conducted by Akshay Saini
- Install React Testing library - npm install --save-dev @testing-library/react
- Install Jest - npm install -D jest
- Configure Jest -> npx jest --init
- Typescript -> N
- environment -> jsdom (broswer-like)
- code coverage -> y
- provider for coverage -> babel
- automatically clear before test -> y
- Creates jest.config.js
- scripts -> test : jest
- npm install -D jest-environment-jsdom
- jest is trying to find test cases in the app under tests folder
- npm install --save-dev babel-jest @babel/core @babel/preset-env - why ? because jest does not understand import statement.
- to configure babel -> babelrc file or babel.config.js
- Add the following code to .babelrc file -> "presets" : [["@babel/preset-env", {"targets": {"node": "current"}}], ["@babel/preset-react", {"runtime" : "automatic"}]]