Open Source Team Metrics based on PRs
at main 1.4 kB view raw
1const nextJest = require('next/jest'); 2 3const 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 9const config = { 10 coverageProvider: 'v8', 11 testEnvironment: 'jsdom', 12 // Add more setup options before each test is run 13 setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], 14 moduleNameMapper: { 15 '^@/(.*)$': '<rootDir>/$1', 16 }, 17 testMatch: [ 18 '**/__tests__/**/*.test.ts', 19 '**/__tests__/**/*.test.tsx', 20 ], 21 collectCoverageFrom: [ 22 'lib/**/*.{ts,tsx}', 23 'app/**/*.{ts,tsx}', 24 'components/**/*.{ts,tsx}', 25 '!**/*.d.ts', 26 '!**/node_modules/**', 27 '!**/.next/**', 28 '!**/coverage/**', 29 ], 30 coverageThreshold: { 31 global: { 32 branches: 60, 33 functions: 60, 34 lines: 60, 35 statements: 60, 36 }, 37 }, 38 testPathIgnorePatterns: ['/node_modules/', '/.next/'], 39 moduleDirectories: ['node_modules', '<rootDir>'], 40 testTimeout: 30000, 41 // Transform TypeScript files 42 transform: { 43 '^.+\\.(js|jsx|ts|tsx)$': ['@swc/jest'], 44 }, 45 // Handle ESM modules 46 transformIgnorePatterns: [ 47 'node_modules/(?!(next-auth|@auth)/)', 48 ], 49}; 50 51// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async 52module.exports = createJestConfig(config);