-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathjest.config.cjs
More file actions
82 lines (78 loc) · 2.96 KB
/
Copy pathjest.config.cjs
File metadata and controls
82 lines (78 loc) · 2.96 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
// 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,
// Ensure ts-jest respects the project's tsconfig settings
tsconfig: 'tsconfig.test.json',
diagnostics: {
// Improve error reporting
warnOnly: false,
pretty: true
}
}]
},
testRegex: "tests/.*Tests\\.ts$",
testPathIgnorePatterns: ["/lib/", "/node_modules/", "/src/"],
moduleFileExtensions: ["ts", "js", "jsx", "json", "node"],
testEnvironment: "jsdom",
testEnvironmentOptions: {
customExportConditions: ["node", "node-addons"]
},
setupFilesAfterEnv: [configFile, './jest.setup.js']
},
{
displayName: "node",
moduleNameMapper: {
"(.+)\\.js": "$1"
},
transform: {
"^.+\\.ts$": ["ts-jest", {
// Match source map configuration with project's tsconfig and gulp build
sourceMap: true,
inlineSourceMap: false,
// Ensure ts-jest respects the project's tsconfig settings
tsconfig: 'tsconfig.test.json',
diagnostics: {
// Improve error reporting
warnOnly: false,
pretty: true
}
}]
},
testRegex: "tests/.*Tests\\.ts$",
testPathIgnorePatterns: ["/lib/", "/node_modules/", "/src/"],
moduleFileExtensions: ["ts", "js", "jsx", "json", "node"],
testEnvironment: "node",
setupFilesAfterEnv: [configFile, './jest.setup.js']
}
],
collectCoverage: false,
testTimeout: 30000,
reporters: [ "default", "jest-junit" ],
testEnvironment: "node"
};