-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjest.config.ts
81 lines (71 loc) · 1.79 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import {
IAppProjSetting,
IOptions,
IProjectInfo,
jestConfGenerator,
} from './jest/src/config';
console.log('=================== LOADING JEST OPTIONS ================');
import tsProjects from './tsconfig.json';
const appProjectsSettings: { [key: string]: IAppProjSetting } = {};
const projectList: { [key: string]: IProjectInfo } = {};
const paths: Record<string, string[]> = tsProjects.compilerOptions.paths;
Object.keys(paths).map((k: string) => {
const path: string = paths[k][0];
if (!k.endsWith('*')) {
projectList[k] = {
path: path.replace('/src', '').replace('./', ''),
sourcePath: path.replace('./', ''),
type: 'library',
};
}
});
const options: IOptions = {
defaultConfOptions: {
transformEsModules: false,
jestConf: {
// injectGlobals: false, -> we can't set it to false because of this issue: https://github.com/golevelup/nestjs/issues/557
},
},
// TODO: re-enable everything except types
skipProjects: ['types', 'graphql', 'crud-gen', 'kafka', 'jest'],
defaultCoverageThreshold: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
confOverrides: {
'@nestjs-yalc/app': {
coverageThreshold: {
statements: 60.76,
branches: 52.08,
functions: 52.94,
lines: 60.55,
},
},
'@nestjs-yalc/logger': {
coverageThreshold: {
statements: 98.02,
branches: 94.4,
functions: 83.87,
lines: 88.7,
},
},
'@nestjs-yalc/utils': {
coverageThreshold: {
statements: 93.44,
branches: 92.85,
functions: 87.17,
lines: 93.83,
},
},
},
};
const conf = jestConfGenerator(
__dirname,
projectList,
appProjectsSettings,
options,
);
conf.injectGlobals = false;
export default conf;