-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathjest.config.cjs
More file actions
97 lines (93 loc) · 3.45 KB
/
jest.config.cjs
File metadata and controls
97 lines (93 loc) · 3.45 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
const fs = require('fs');
const path = require('path');
// Default configuration file
const defaultConfigFile = './secrets/TestConfiguration.ts';
const configJsonFile = './secrets/test.subscriptions.regions.json';
// Determine which configuration file to use
const getConfigFile = () => {
if (configJsonFile && fs.existsSync(path.resolve(configJsonFile))) {
console.log(`Using JSON configuration: ${configJsonFile}`);
return configJsonFile;
}
console.log(`Using default configuration: ${defaultConfigFile}`);
return defaultConfigFile;
};
const configFile = getConfigFile();
module.exports = {
projects: [
{
displayName: "jsdom",
moduleNameMapper: {
"(.+)\\.js": "$1"
},
transform: {
"^.+\\.ts$": ["ts-jest", {
// Match source map configuration with project's tsconfig and gulp build
sourceMap: true,
inlineSourceMap: false,
// Enable pathMapping to ensure correct line number reporting
pathMapping: {
'^(.*)\\.js$': '$1.ts'
}
}]
},
testRegex: "tests/.*Tests\\.ts$",
testPathIgnorePatterns: ["/lib/", "/node_modules/", "/src/"],
moduleFileExtensions: ["ts", "js", "jsx", "json", "node"],
testEnvironment: "jsdom",
collectCoverage: false,
setupFilesAfterEnv: [configFile, './jest.setup.js'],
testTimeout : 20000,
globals: {
'ts-jest': {
// Ensure ts-jest respects the project's tsconfig settings
tsconfig: 'tsconfig.json',
diagnostics: {
// Improve error reporting
warnOnly: true,
pretty: true
}
}
}
},
{
displayName: "node",
moduleNameMapper: {
"(.+)\\.js": "$1"
},
transform: {
"^.+\\.ts$": ["ts-jest", {
// Match source map configuration with project's tsconfig and gulp build
sourceMap: true,
inlineSourceMap: false,
// Enable pathMapping to ensure correct line number reporting
pathMapping: {
'^(.*)\\.js$': '$1.ts'
}
}]
},
testRegex: "tests/.*Tests\\.ts$",
testPathIgnorePatterns: ["/lib/", "/node_modules/", "/src/"],
moduleFileExtensions: ["ts", "js", "jsx", "json", "node"],
testEnvironment: "node",
collectCoverage: false,
setupFilesAfterEnv: [configFile, './jest.setup.js'],
testTimeout : 30000,
globals: {
'ts-jest': {
// Ensure ts-jest respects the project's tsconfig settings
tsconfig: 'tsconfig.json',
diagnostics: {
// Improve error reporting
warnOnly: true,
pretty: true
}
}
}
}
],
reporters: [ "default", "jest-junit" ],
testEnvironment: "node"
};