-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
56 lines (53 loc) · 1.34 KB
/
jest.config.js
File metadata and controls
56 lines (53 loc) · 1.34 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
const nextJest = require('next/jest')
const createJestConfig = nextJest({
dir: './',
})
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@/components/(.*)$': '<rootDir>/src/components/$1',
'^@/lib/(.*)$': '<rootDir>/src/lib/$1',
'^@/types/(.*)$': '<rootDir>/src/types/$1',
'^@/contexts/(.*)$': '<rootDir>/src/contexts/$1',
},
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/', '<rootDir>/tests/e2e/'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
'!src/**/index.{js,ts}',
'!src/app/**/*.tsx',
'!src/cli/**/*.ts',
],
coverageThreshold: {
global: {
branches: 2,
functions: 2,
lines: 6,
statements: 6,
},
},
testMatch: [
'**/__tests__/**/*.{js,jsx,ts,tsx}',
'**/*.{spec,test}.{js,jsx,ts,tsx}',
],
transform: {
'^.+\\.(ts|tsx|js|jsx)$': ['@swc/jest', {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
},
transform: {
react: {
runtime: 'automatic',
},
},
},
}],
},
}
module.exports = createJestConfig(customJestConfig)