-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
52 lines (51 loc) · 1.28 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
import path from 'path';
const rootDirectory = path.resolve(__dirname);
export default {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
coverageThreshold: {
global: {
branches: 70,
function: 80,
lines: 80,
statements: 80,
},
},
globals: {
'ts-jest': {
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
},
},
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'@server(.*)$': `${rootDirectory}/src$1`,
'@config(.*)$': `${rootDirectory}/src/config$1`,
'@tests(.*)$': `${rootDirectory}/__tests__$1`,
},
reporters: [
'default',
[
path.resolve(__dirname, 'node_modules', 'jest-html-reporter'),
{
pageTitle: 'Demo test Report',
outputPath: 'test-report.html',
},
],
],
rootDir: rootDirectory,
roots: [rootDirectory],
setupFilesAfterEnv: [`${rootDirectory}/__tests__/setup.ts`],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/build',
`${rootDirectory}/__tests__/fixtures`,
`${rootDirectory}/__tests__/setup.ts`,
],
transform: {
'^.+\\.ts$': 'ts-jest',
},
testRegex: ['((/__tests__/.*)|(\\.|/)(test|spec))\\.tsx?$'],
};