npm install typescript @types/react @types/node -Dnpm i jest @testing-library/react @types/jest babel-jest @testing-library/jest-dom @testing-library/user-event @testing-library/dom -DAdd to package.json:
"test": "jest --watch"Add to .eslintrc.json:
{ "env": { "jest": true }}Add to .babelrc:
{ "presets": ["next/babel"]}Create jest.config.js
module.exports = { setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],};Create jest.setup.ts
import '@testing-library/jest-dom';