-
Notifications
You must be signed in to change notification settings - Fork 384
/
jest.config.js
78 lines (75 loc) · 2.18 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const { pathsToModuleNameMapper } = require("ts-jest")
const tsConfig = require("./tsconfig.json")
const tsConfigPathMapping = pathsToModuleNameMapper(
tsConfig.compilerOptions.paths,
{
prefix: "<rootDir>/",
}
)
const testMatch = ["**/?(*.)test.(js|ts|tsx)", "**/test/index.(js|ts|tsx)"]
/**
* @type {import('jest').Config}
*/
module.exports = {
roots: ["<rootDir>/packages/"],
collectCoverageFrom: [
"**/*.{ts,tsx}",
"!**/*.d.ts",
"!**/*.test-d.{ts,tsx}",
"!**/node_modules/**",
"!**/build/**",
"!**/fixtures/**",
],
coverageDirectory: "<rootDir>/coverage/",
coveragePathIgnorePatterns: [
"node_modules",
"scripts",
"test",
".*.json$",
".*.js.snap$",
],
coverageReporters: ["lcov", "text"],
globalSetup: "./scripts/jest/setupTimezone.js",
projects: [
{
displayName: "web",
testEnvironment: "jsdom",
testMatch,
moduleNameMapper: tsConfigPathMapping,
roots: ["<rootDir>/packages/react"],
},
{
displayName: "universal",
testEnvironment: "jest-environment-node-single-context",
testMatch,
moduleNameMapper: tsConfigPathMapping,
roots: ["<rootDir>/packages/core", "<rootDir>/packages/remote-loader"],
},
{
displayName: "node",
testEnvironment: "jest-environment-node-single-context",
testMatch,
moduleNameMapper: tsConfigPathMapping,
snapshotSerializers: [
require.resolve("./scripts/jest/stripAnsiSerializer.js"),
],
setupFilesAfterEnv: [require.resolve("./scripts/jest/env.js")],
roots: [
"<rootDir>/packages/babel-plugin-extract-messages",
"<rootDir>/packages/babel-plugin-lingui-macro",
"<rootDir>/packages/cli",
"<rootDir>/packages/conf",
"<rootDir>/packages/loader",
"<rootDir>/packages/metro-transformer",
"<rootDir>/packages/macro",
"<rootDir>/packages/vite-plugin",
"<rootDir>/packages/format-po",
"<rootDir>/packages/format-po-gettext",
"<rootDir>/packages/format-json",
"<rootDir>/packages/format-csv",
"<rootDir>/packages/message-utils",
"<rootDir>/packages/extractor-vue",
],
},
],
}