-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
42 lines (39 loc) · 1.23 KB
/
jest.config.ts
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
import nextJest from '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 = {
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
moduleDirectories: ['node_modules', __dirname],
transform: {
'^.+\\.tsx?$': '@swc/jest',
},
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
coveragePathIgnorePatterns: [
'index.ts',
'src/pages/_app.page.tsx',
'src/pages/_error.page.tsx',
'src/pages/_document.page.tsx',
'src/components/icons/*',
'src/graphql/queries/*',
'src/graphql/mutations/*',
'src/graphql/types/*',
],
moduleNameMapper: {
'\\.(scss|css)$': 'identity-obj-proxy',
},
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(customJestConfig)