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