forked from project-flogo/flogo-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
35 lines (33 loc) · 1.04 KB
/
jest.config.js
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
const projectsConfig = require('./angular.json');
const jestProjectRoots = getJestProjectsRoots(projectsConfig).join(',');
module.exports = {
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.spec.json',
},
__TS_CONFIG__: {
inlineSourceMap: true,
},
__TRANSFORM_HTML__: true,
},
testMatch: [`**/{${jestProjectRoots}}/**/+(*.)+(spec|test).+(ts|js)?(x)`],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
preset: 'ts-jest',
resolver: '@nrwl/builders/plugins/jest/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
collectCoverage: false,
coverageReporters: ['html'],
setupTestFrameworkScriptFile: '<rootDir>/jest.setup.ts',
};
function getJestProjectsRoots(projectsConfig) {
const jestPattern = /jest/;
const projectUsesJest = project => {
const testConfig = (project.architect || {}).test || {};
return testConfig.builder && jestPattern.test(testConfig.builder);
};
return Object.values(projectsConfig.projects)
.filter(projectUsesJest)
.map(p => p.root.replace(/\/$/, ''));
}