-
Notifications
You must be signed in to change notification settings - Fork 29
/
jest.config.js
60 lines (55 loc) · 1.29 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
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
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 = ["plugins/flipper", "commands/measure", "core/web-reporter-ui"];
const NODE_PACKAGES = [
"platforms/android",
"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",
})),
...NODE_PACKAGES.map((name) => ({
name,
testEnvironment: "node",
})),
].map(({ name, testEnvironment }) => ({
...commonOptions,
displayName: name,
testEnvironment,
testMatch: [`<rootDir>/packages/${name}/**/__tests__/**/*.{ts,tsx}`],
})),
};