-
Notifications
You must be signed in to change notification settings - Fork 4
/
jest.config.ts
57 lines (54 loc) · 1.64 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
52
53
54
55
56
57
import nextJest from 'next/jest.js';
import type { Config } from '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: './',
});
// Add any custom config to be passed to Jest
const config: Config = {
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
prettierPath: require.resolve('prettier-2'),
collectCoverageFrom: [
'app/**/*.{js,jsx,ts,tsx}',
'!app/api/**',
'!app/services/**',
'!**/node_modules/**',
'!**/page.tsx',
'!**/layout.tsx',
'!**/error.tsx',
'!**/loading.tsx',
'!**/not-found.tsx',
'!**/global.d.ts',
'!app/components/chat.tsx',
'!app/components/window.tsx',
'!app/components/IconSVG/**',
'!app/hooks/*',
'!app/benchmarking/types/**',
'!app/lib/fetchApis/**',
'!app/**/_tests_/**',
],
coverageProvider: 'v8',
collectCoverage: true,
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
coverageReporters: ['html', 'text', 'json-summary', 'text-summary'],
reporters: ['default', ['jest-html-reporter', { pageTitle: 'Test Report' }]],
testResultsProcessor: './node_modules/jest-json-reporter',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^@/app/components/(.*)$': '<rootDir>/app/components/$1',
},
watchPathIgnorePatterns: [
'<rootDir>/test-report.html',
'<rootDir>/test-results.json',
],
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);