How to test a React App, with Jest and react-testing-library

1 · Alex Adam · Jan. 15, 2022, 9:44 a.m.
Prerequisites: An existing React app.You can find the full source code @ github: https://github.com/alexadam/project-templates/tree/master/projects/react-app-testsSetupInstall Jest and react-testing-libraryyarn add --dev jest @types/jest ts-jest @testing-library/react @testing-library/jest-domIn the project’s root folder, create a file named jest.config.js and add:module.exports = { roots: ["./src"], transform: { "^.+\\.tsx?$": "ts-jest" }, testEnvironment: 'jest-environment-jsdom', setu...