-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
jest.config.js
58 lines (57 loc) 路 2.1 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
const supportsESM = parseInt(process.versions.node) >= 12;
const isESMBuild = true; // bool(process.env.BABEL_ESM_BUILD);
module.exports = {
resolver: "<rootDir>/jest-resolver.js",
collectCoverageFrom: [
"packages/*/src/**/*.{js,mjs,ts}",
"codemods/*/src/**/*.{js,mjs,ts}",
"eslint/*/src/**/*.{js,mjs,ts}",
],
// The eslint/* packages use ESLint v6, which has dropped support for Node v6.
// TODO: Remove this process.version check in Babel 8.
testRegex: `./(packages|codemods${
Number(process.versions.node.split(".")[0]) < 10 ? "" : "|eslint"
})/[^/]+/test/.+\\.m?js$`,
testPathIgnorePatterns: [
"/node_modules/",
"/test/fixtures/",
"/test/debug-fixtures/",
"/babel-parser/test/expressions/",
"/test/tmp/",
"/test/__data__/",
"/test/helpers/",
"<rootDir>/test/warning\\.js",
"<rootDir>/build/",
"<rootDir>/.history/", // local directory for VSCode Extension - https://marketplace.visualstudio.com/items?itemName=xyz.local-history
"_browser\\.js",
isESMBuild && "<rootDir>/eslint",
isESMBuild && "/babel-register/",
isESMBuild && "/babel-node/",
isESMBuild && "/babel-standalone/",
].filter(Boolean),
testEnvironment: "node",
setupFilesAfterEnv: ["<rootDir>/test/testSetupFile.js"],
transformIgnorePatterns: [
"/node_modules/",
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
"/test/(fixtures|tmp|__data__)/",
"<rootDir>/(packages|codemods|eslint)/[^/]+/lib/",
],
coveragePathIgnorePatterns: [
"/node_modules/",
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
"/test/(fixtures|tmp|__data__)/",
],
modulePathIgnorePatterns: [
"/test/fixtures/",
"/test/tmp/",
"/test/__data__/",
"<rootDir>/build/",
],
resolver: supportsESM ? "./test/jestExportsMapResolver.cjs" : null,
extensionsToTreatAsEsm: supportsESM ? [".ts"] : null,
// We don't need module name mappers here as depedencies of workspace
// package should be declared explicitly in the package.json
// Yarn will generate correct file links so that Jest can resolve correctly
moduleNameMapper: null,
};