-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.config.js
More file actions
38 lines (34 loc) · 1.06 KB
/
jest.config.js
File metadata and controls
38 lines (34 loc) · 1.06 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
import nextJest from 'next/jest.js';
const createJestConfig = nextJest({
dir: './',
});
const customJestConfig = {
coverageProvider: 'v8',
testEnvironment: 'jest-fixed-jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
coveragePathIgnorePatterns: ['/node_modules/', '/.next/', '/e2e/'],
testPathIgnorePatterns: ['/node_modules/', '/.next/', '/e2e/', '/src/components/pages/schedule/'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{js,jsx,ts,tsx}',
'!src/app/**',
],
coverageReporters: ['json-summary', 'text', 'lcov', 'clover'],
coverageDirectory: 'coverage',
};
const jestConfig = async () => {
const nextJestConfig = await createJestConfig(customJestConfig)();
return {
...nextJestConfig,
moduleNameMapper: {
'\\.svg$': '<rootDir>/src/mock/svg.tsx',
...nextJestConfig.moduleNameMapper,
},
};
};
export default jestConfig;