/
jest.config.ts
51 lines (49 loc) · 1.45 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
43
44
45
46
47
48
49
50
51
import nextJest from 'next/jest'
const jestConfig = async () => {
const createJestConfig = nextJest()
const customJestConfig = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['**/*.ts?(x)'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
'/node_modules/',
'/.storybook/',
'/pages/_app.tsx',
'/pages/_document.tsx',
'/context/',
'.spec.tsx?$',
'.stories.tsx?$',
'.d.ts$',
'.config.ts$',
],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleNameMapper: {
'\\.s?css$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
},
setupFilesAfterEnv: ['<rootDir>/config/jest-setup-after-env.ts'],
setupFiles: ['<rootDir>/config/jest-setup.ts'],
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['/node_modules/', '/__test__/e2e/'],
}
const nextJestConfig = await createJestConfig(customJestConfig)()
return {
...nextJestConfig,
moduleNameMapper: {
'\\.s?css$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
...nextJestConfig.moduleNameMapper,
},
}
}
export default jestConfig