Unknown
Step 1 : Create React Project Using create-react-app
npx create-react-app jest-testing-library
Step 2 : Install React testing library dependencies
npm install --save-dev @testing-library/react @testing-library/jest-dom
ORyarn add --dev @testing-library/react @testing-library/jest-dom
Step 3 : Install Jest dependecies
npm install --save-dev jest jest-environment-jsdom
ORyarn add --dev jest jest-environment-jsdom
Step 4 : Configure Jest
Create a file named jest.config.js in the root folder and add the following code configuration.
Step 5 : Writing tests
Create One Component
Example.jsx
Example.test.jsx
Output