Repository navigation
Expand file tree
/
Copy pathjest.config.js
More file actions
50 lines (50 loc) · 2.71 KB
/
Copy pathjest.config.js
File metadata and controls
50 lines (50 loc) · 2.71 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
/* eslint-disable prettier/prettier */
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
displayName: "test",
testEnvironment: "jest-environment-jsdom",
workerIdleMemoryLimit: "512MB",
preset: "ts-jest/presets/js-with-ts-esm",
transform: {
"^.+\\.[t|j]sx?$": "babel-jest",
},
setupFilesAfterEnv: ["<rootDir>src/setupTests.ts"],
testPathIgnorePatterns: ["<rootDir>/cypress/", "<rootDir>/coverage/", "<rootDir>/build/", "<rootDir>/node_modules/", "<rootDir>/.claude/"],
// Git worktrees under .claude/worktrees are full copies of the repo: without this the haste map
// sees every package and manual mock twice and refuses to resolve `@citeck/records-core`.
modulePathIgnorePatterns: ["<rootDir>/.claude/"],
moduleDirectories: ["node_modules", "src"],
testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
moduleNameMapper: {
"\\.(css|scss)$": "<rootDir>/src/__mocks__/style.mock.js",
"\\.(png|jpg)$": "<rootDir>/src/__mocks__/image.mock.js",
"^(.*)\\?worker$": "<rootDir>/src/__mocks__/worker.mock.js",
"^@citeck/records-core$": "<rootDir>/packages/records-core/src/index.ts",
"^@citeck/records-core/(.*)$": "<rootDir>/packages/records-core/src/$1",
"^@citeck/records-predicates$": "<rootDir>/packages/records-predicates/src/index.ts",
"^@citeck/records-predicates/(.*)$": "<rootDir>/packages/records-predicates/src/$1",
"^@citeck/constants$": "<rootDir>/packages/constants/src/index.ts",
"^@citeck/constants/(.*)$": "<rootDir>/packages/constants/src/$1",
"^@/constants$": "<rootDir>/packages/constants/src/index.ts",
// These bpmn/diagram mocks MUST precede the "@/(.*)$" catch-all. The heavy
// bpmn-js/diagram-js modeler code is stubbed in jsdom tests by matching the
// "BPMN"/"bpmn-js"/"diagram-js" substring in the import path. Components used to
// be imported via relative paths (e.g. "../ModelEditor/BPMNModeler/modules"),
// which fell through to these stubs. Now that cross-folder imports use the "@/"
// alias, the catch-all would resolve the real module first unless these come first.
"bpmn-js*": "<rootDir>/src/mock.js",
"BPMN*": "<rootDir>/src/mock.js",
"diagram-js*": "<rootDir>/src/mock.js",
"@/(.*)$": "<rootDir>/src/$1",
"react-markdown": "<rootDir>/src/__mocks__/react-markdown.mock.js",
"remark-gfm": "<rootDir>/src/__mocks__/remark-gfm.mock.js",
// jsdom resolves the `browser` (ESM) entry of `yaml`, which jest can't parse — pin the CJS dist build.
"^yaml$": "<rootDir>/node_modules/yaml/dist/index.js",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "scss", "png", "node"],
globals: {
"ts-jest": {
tsconfig: "tsconfig.json",
},
},
};