const nextJest = require('next/jest') const createJestConfig = nextJest({ // Provide the path to your Next.js app to load next.config.js and .env files in your test environment dir: './', }) // Add any custom config to be passed to Jest const customJestConfig = { setupFilesAfterEnv: ['/__tests__/setup.ts'], testEnvironment: 'jest-environment-jsdom', moduleNameMapper: { '^@/(.*)$': '/$1', }, collectCoverageFrom: [ 'app/**/*.{ts,tsx}', 'components/**/*.{ts,tsx}', 'hooks/**/*.{ts,tsx}', 'lib/**/*.{ts,tsx}', '!**/*.d.ts', '!**/node_modules/**', '!**/.next/**', '!**/coverage/**', '!**/jest.config.js', ], coverageThreshold: { global: { branches: 90, functions: 90, lines: 90, statements: 90, }, }, testPathIgnorePatterns: [ '/.next/', '/node_modules/', '/src/', '/angular-backup/', ], transformIgnorePatterns: [ '/node_modules/', '^.+\\.module\\.(css|sass|scss)$', ], } // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async module.exports = createJestConfig(customJestConfig)