Repository navigation
Expand file tree
/
Copy pathjest.config.js
More file actions
67 lines (62 loc) · 1.74 KB
/
Copy pathjest.config.js
File metadata and controls
67 lines (62 loc) · 1.74 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
const commonOptions = {
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
// we already get TS errors with tsc, so no need to have them here
diagnostics: false,
},
],
},
testPathIgnorePatterns: [
"\\.snap$",
"/node_modules/",
"/dist/",
"/examples/e2e/",
"/measure/src/__tests__/utils/",
],
setupFiles: ["<rootDir>/jest-setup.ts"],
};
const WEB_PACKAGES = ["commands/measure", "core/web-reporter-ui"];
const NODE_PACKAGES = [
"platforms/android",
"platforms/ios-instruments",
"plugins/appium-helper",
"plugins/appium-test-cases",
"plugins/aws-device-farm",
"commands/test",
"plugins/eslint",
"core/reporter",
"core/shell",
"commands/report",
];
module.exports = {
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
collectCoverageFrom: [
"**/*.{ts,tsx}",
"!**/node_modules/**",
"!**/dist/**",
"!**/cpp-profiler/**",
],
projects: [
...WEB_PACKAGES.map((name) => ({
name,
testEnvironment: "jsdom",
// ServerApp boots a real socket.io server inside this jsdom project. jsdom resolves the
// "browser" export condition, which hands engine.io the `ws` browser stub (no .Server),
// so this project needs node resolution.
testEnvironmentOptions:
name === "commands/measure" ? { customExportConditions: ["node"] } : undefined,
})),
...NODE_PACKAGES.map((name) => ({
name,
testEnvironment: "node",
})),
].map(({ name, testEnvironment, testEnvironmentOptions }) => ({
...commonOptions,
displayName: name,
testEnvironment,
...(testEnvironmentOptions ? { testEnvironmentOptions } : {}),
testMatch: [`<rootDir>/packages/${name}/**/__tests__/**/*.{ts,tsx}`],
})),
};