generated from obetancourthunicah/express-ts-sw-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.ts
59 lines (58 loc) · 1.65 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
58
59
import path from 'path';
const rootDirector = 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(.*)$": `${rootDirector}/src$1`,
"@tests(.*)$": `${rootDirector}/__tests__$1`,
"@config(.*)$": `${rootDirector}/src/config$1`,
"@handlers(.*)$": `${rootDirector}/src/handlers$1`,
"@libs(.*)$": `${rootDirector}/src/libs$1`,
"@middleware(.*)$": `${rootDirector}/src/middleware$1`,
"@models(.*)$": `${rootDirector}/src/dao/models$1`,
"@routes(.*)$": `${rootDirector}/src/routes$1`,
"@utils(.*)$": `${rootDirector}/src/utils$1`,
"@dao(.*)$": `${rootDirector}/src/dao$1`
},
reporters: [
'default',
[
path.resolve(__dirname, 'node_modules', 'jest-html-reporter'),
{
pageTitle: 'Demo test Report',
outputPath: 'test-report.html',
},
],
],
rootDir: rootDirector,
roots: [rootDirector],
setupFilesAfterEnv: [`${rootDirector}/__tests__/setup.ts`],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/build',
`${rootDirector}/__tests__/fixtures`,
`${rootDirector}/__tests__/setup.ts`,
],
transform: {
'^.+\\.ts$': 'ts-jest',
},
testRegex: ['((/__tests__/.*)|(\\.|/)(test|spec))\\.tsx?$'],
};