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: './', }); const customJestConfig = { moduleNameMapper: { // Handle module aliases (this will be automatically configured for you soon) '^@/(.*)$': '/src/$1', '^@/public/(.*)$': '/public/$1', }, setupFilesAfterEnv: ['./jest.setup.js'], clearMocks: true, collectCoverage: true, collectCoverageFrom: [ './src/**/*.{js,jsx,ts,tsx}', '!./src/**/_*.{js,jsx,ts,tsx}', '!**/*.d.ts', '!**/node_modules/**', ], coverageThreshold: { global: { branches: 80, functions: 80, lines: 80, statements: 80, }, }, testEnvironment: 'jest-environment-jsdom', }; module.exports = createJestConfig(customJestConfig);