-
-
Notifications
You must be signed in to change notification settings - Fork 739
/
Copy pathjest.config.ts
54 lines (51 loc) · 1.66 KB
/
jest.config.ts
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
import type { Config } from "@jest/types";
const sharedConfig: Config.InitialOptions = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
fakeTimers: { enableGlobally: true },
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"],
"^(\\.\\.?\\/.+)\\.jsx?$": "$1" // see https://github.com/kulshekhar/ts-jest/issues/1057
}
},
{
...sharedConfig,
displayName: "examples",
roots: ["<rootDir>/examples"],
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/persian": ["<rootDir>/src/persian.tsx"],
"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"],
moduleNameMapper: {
"@/test/(.*)": ["<rootDir>/test/$1"],
"react-day-picker/persian": ["<rootDir>/dist/cjs/persian.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;