-
Notifications
You must be signed in to change notification settings - Fork 116
/
Copy pathjest.config.js
57 lines (56 loc) · 2.21 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
const TestTheme = require("./.jest/globals/TestTheme");
module.exports = {
globals: {
TestTheme,
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|jsx|ts|tsx)?$",
testEnvironment: "jsdom",
testPathIgnorePatterns: [
"<rootDir>/packages/(?:.+?)/dist/",
"<rootDir>/packages/(?:.+?)/.cache/",
"<rootDir>/cypress/",
"<rootDir>/apps/",
"<rootDir>/packages/(?:.+?)/.next/",
"<rootDir>/templates/(?:.+?)/.next/",
"<rootDir>/.nx/",
],
cacheDirectory: ".jest-cache",
coverageDirectory: ".jest-coverage",
coveragePathIgnorePatterns: [
"<rootDir>/packages/(?:.+?)/dist/",
"<rootDir>/packages/(?:.+?)/cjs/",
"<rootDir>/packages/(?:.+?)/esm/",
"<rootDir>/apps/",
],
coverageReporters: ["html", "text"],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleNameMapper: {
"\\.css$": "identity-obj-proxy",
// monkey-patch introduced for @testing-library/user-event to improve asynchronous test readability
// taken from this github issue: https://github.com/testing-library/user-event/issues/938#issuecomment-1111976312
"^@testing-library/user-event$": "<rootDir>/tools/test/act-user-event.ts",
"^@testing-library/real-user-event$": require.resolve("@testing-library/user-event"),
// monkey-patch to help with @testing-library/reat-hooks being deprecated
// the render hook method is being exported from @testing-library/react in later versions
"^@testing-library/react$": "<rootDir>/tools/test/react-testing-library.ts",
"^@testing-library/real-react$": require.resolve("@testing-library/react"),
// helper method to handle the changes in the react-dom api for react 18
"^testing-tools/react-dom-create-root$": "<rootDir>/tools/test/react-dom-create-root.ts",
// jest can't find lerna for the codemod tests, so we need to tell it where to look
"^lerna$": require.resolve("lerna"),
},
transformIgnorePatterns: ["node_modules/"],
transform: {
"^.+\\.(js|jsx|ts|tsx)?$": "@swc/jest",
},
extensionsToTreatAsEsm: [".ts", ".tsx"],
setupFilesAfterEnv: ["<rootDir>/.jest/setupFilesAfterEnv.js"],
snapshotSerializers: ["@emotion/jest/serializer"],
};