-
-
Notifications
You must be signed in to change notification settings - Fork 770
Expand file tree
/
Copy pathjest.config.ts
More file actions
93 lines (89 loc) · 3.8 KB
/
jest.config.ts
File metadata and controls
93 lines (89 loc) · 3.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
if (process.env.TZ) {
console.log(`Running tests in ${process.env.TZ} timezone`);
}
import type { Config } from "@jest/types";
const sharedConfig: Config.InitialOptions = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
transform: {
"^.+\\.tsx?$": [
"@swc/jest",
{ jsc: { transform: { react: { runtime: "automatic" } } } },
],
"^.+\\.css$": "jest-transform-css",
},
};
const config: Config.InitialOptions = {
coverageReporters: ["lcov", "text", "clover"],
projects: [
{
...sharedConfig,
displayName: "src",
roots: ["<rootDir>/src"],
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/locale/(.*)\\.js": ["<rootDir>/src/locale/$1.ts"],
"react-day-picker/locale/(.*)": ["<rootDir>/src/locale/$1"],
"react-day-picker/locale": ["<rootDir>/src/locale.ts"],
"^(\\.\\.?\\/.+)\\.jsx?$": "$1", // see https://github.com/kulshekhar/ts-jest/issues/1057
},
},
{
...sharedConfig,
displayName: "examples",
roots: ["<rootDir>/examples"],
testPathIgnorePatterns: ["<rootDir>/examples/timezone/"],
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/buddhist": ["<rootDir>/src/buddhist/index.tsx"],
"react-day-picker/hebrew": ["<rootDir>/src/hebrew/index.tsx"],
"react-day-picker/hijri": ["<rootDir>/src/hijri/index.tsx"],
"react-day-picker/ethiopic": ["<rootDir>/src/ethiopic/index.tsx"],
"react-day-picker/persian": ["<rootDir>/src/persian.tsx"],
"react-day-picker/locale/(.*)\\.js": ["<rootDir>/src/locale/$1.ts"],
"react-day-picker/locale/(.*)": ["<rootDir>/src/locale/$1"],
"react-day-picker/locale": ["<rootDir>/src/locale.ts"],
"react-day-picker": ["<rootDir>/src/index.ts"],
"^(\\.\\.?\\/.+)\\.jsx?$": "$1", // see https://github.com/kulshekhar/ts-jest/issues/1057
},
},
{
...sharedConfig,
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
displayName: "examples/timezone",
roots: ["<rootDir>/examples/timezone"],
fakeTimers: { enableGlobally: false }, // disable fake timers for timezone tests because they interfere with Intl API
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/locale/(.*)\\.js": ["<rootDir>/src/locale/$1.ts"],
"react-day-picker/locale/(.*)": ["<rootDir>/src/locale/$1"],
"react-day-picker/locale": ["<rootDir>/src/locale.ts"],
"react-day-picker": ["<rootDir>/src/index.ts"],
"^(\\.\\.?\\/.+)\\.jsx?$": "$1", // see https://github.com/kulshekhar/ts-jest/issues/1057
},
},
{
...sharedConfig,
displayName: "examples/built",
roots: ["<rootDir>/examples"],
testPathIgnorePatterns: ["<rootDir>/examples/timezone/"],
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/buddhist": ["<rootDir>/dist/cjs/buddhist/index.js"],
"react-day-picker/hebrew": ["<rootDir>/dist/cjs/hebrew/index.js"],
"react-day-picker/hijri": ["<rootDir>/dist/cjs/hijri/index.js"],
"react-day-picker/ethiopic": ["<rootDir>/dist/cjs/ethiopic/index.js"],
"react-day-picker/persian": ["<rootDir>/dist/cjs/persian.js"],
"react-day-picker/locale/(.*)\\.js": [
"<rootDir>/dist/cjs/locale/$1.js",
],
"react-day-picker/locale/(.*)": ["<rootDir>/dist/cjs/locale/$1"],
"react-day-picker/locale": ["<rootDir>/dist/cjs/locale.js"],
"react-day-picker": ["<rootDir>/dist/cjs/index.js"],
"../src": ["<rootDir>/dist/cjs"], // allow using same @/test/elements in both env
"^(\\.\\.?\\/.+)\\.jsx?$": "$1", // see https://github.com/kulshekhar/ts-jest/issues/1057
},
},
],
};
export default config;