jest.config.js (589B)
1 const nextJest = require('next/jest') 2 3 const createJestConfig = nextJest({ 4 // Provide the path to your Next.js app to load next.config.js and .env files in your test environment 5 dir: './', 6 }) 7 8 // Add any custom config to be passed to Jest 9 const customJestConfig = { 10 setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], 11 moduleNameMapper: { 12 '^@/(.*)$': '<rootDir>/$1', 13 }, 14 testEnvironment: 'jest-environment-jsdom', 15 } 16 17 // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async 18 module.exports = createJestConfig(customJestConfig)