npm create vite
Project name: testing-with-react Select a framework: React Select a variant: Typescript
cd test-with-react npm install npm run dev
npm install typescript ts-node --save-dev npm install jest --save-dev npm install ts-jest @types/jest --save-dev npm install @testing-library/react --save-dev npm install @testing-library/jest-dom --save-dev npm install jest-environment-jsdom --save-dev npm install identity-obj-proxy --save-dev
(see file)
test/mocks/fileMock.js
test/App.spec.tsx
NOTE: This folder structure with /test/mock and /test seems a bit janky to me. I copied an example but haven't explored how to do it a cleaner way.
Add the following to package.json under "scripts"
"test": "jest"
npm test
or
./node_modules/.bin/jest