forked from flexport/__latitude
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
62 lines (57 loc) · 1.72 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
61
62
/**
* TEAM: frontend_infra
* @noflow
*/
/* eslint-disable flowtype/require-valid-file-annotation */
const parallelism = require("ci-parallel-vars");
const chunkd = require("chunkd");
const config = {
timers: "fake",
setupFilesAfterEnv: [
"<rootDir>/_harness/jestTestSetup.js",
],
snapshotSerializers: ["enzyme-to-json/serializer"],
unmockedModulePathPatterns: ["<rootDir>/node_modules"],
testPathIgnorePatterns: ["node_modules/", "mobile/drive/"],
transform: {
"^.+\\.jsx?$": "babel-jest",
"^.+\\.(css|less)$":
"<rootDir>/_harness/mockStyle.js",
},
transformIgnorePatterns: ["node_modules/(?!(flexport-shared)/)"],
testRegex: "/__tests__/.*-test\\.jsx?$",
testMatch: undefined,
moduleFileExtensions: ["js", "jsx", "json"],
modulePaths: ["<rootDir>"],
moduleDirectories: [".", "node_modules"],
moduleNameMapper: {
"(\\.(css|less)$|^reset-css$)":
"<rootDir>/_harness/mockStyle.js",
},
coverageDirectory: "./coverage/",
coveragePathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/babel.config.js",
],
testEnvironmentOptions: {
url: "https://app.flexport.com/",
},
testEnvironment: "jest-environment-jsdom-global",
setupFiles: ["<rootDir>/_harness/jestSetup.js"],
globals: {
USE_UNWRAPPED_FRAGMENT_CONTAINERS: true,
AVOID_PORTAL_RENDER: true,
},
};
const jestTests = process.env.JEST_TESTS;
if (jestTests) {
// When a list of tests is provided, run a subset of that list according to
// ci-parallel-vars
let tests = JSON.parse(jestTests).sort((a, b) => b.localeCompare(a));
if (parallelism) {
tests = chunkd(tests, parallelism.index, parallelism.total);
}
config.testMatch = tests;
delete config.testRegex;
}
module.exports = config;