forked from HadoukenIO/layouts-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest-default-config.js
48 lines (45 loc) · 1.32 KB
/
jest-default-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
36
37
38
39
40
41
42
43
44
45
46
47
48
module.exports = function createConfig(testType) {
return {
rootDir: "test",
transform: {
"^.+\\.tsx?$": "<rootDir>/../node_modules/ts-jest"
},
testRegex: "." + testType + "test.ts$",
testRunner: "jest-circus/runner",
modulePaths: [
"<rootDir>/../node_modules"
],
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
reporters: [
"default",
["jest-junit", {
"outputDirectory": "./dist/test",
"outputName": 'results-' + testType + '.xml',
"classNameTemplate": (vars) => {
const filePathTokens = vars.filepath.split('\\');
let fileName = filePathTokens[filePathTokens.length - 1];
fileName = fileName.split('.')[0];
filePathTokens[filePathTokens.length - 1] = fileName;
return testType + '.' + filePathTokens.join('.');
},
"titleTemplate": (vars) => {
let title;
if (vars.classname) {
title = vars.classname + ' > ' + vars.title;
} else {
title = vars.title;
}
return title.replace(/\./g, '•');
},
"ancestorSeparator": " > "
}]
]
}
};