generated from lemonadern/template-nextjs-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
44 lines (41 loc) · 1.05 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// eslint-disable-next-line @typescript-eslint/no-var-requires
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 = {
rootDir: process.cwd(),
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>/node_modules/',
'<rootDir>/coverage',
'<rootDir>/dist',
'<rootDir>/e2e/',
],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/utils/report-accessibility.ts',
'!src/pages/_app.tsx',
'!src/**/*.stories.tsx',
'!src/components/**/index.ts',
],
testEnvironment: 'jsdom',
transform: {
'.*\\.(tsx?|jsx?)$': [
'@swc/jest',
{
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
},
],
},
};
module.exports = createJestConfig(customJestConfig);