-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.cjs
More file actions
83 lines (83 loc) · 2.66 KB
/
Copy pathjest.config.cjs
File metadata and controls
83 lines (83 loc) · 2.66 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
/** @type {import('jest').Config} */
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
setupFilesAfterEnv: [
"<rootDir>/test/ts/setup.ts",
"<rootDir>/jest.canvasSetup.cjs",
],
extensionsToTreatAsEsm: [".ts", ".tsx"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
"^react-router-dom$": "<rootDir>/node_modules/react-router-dom/dist/index.js",
"^@n-apt/consts$": "<rootDir>/src/ts/consts",
"^@n-apt/md-preview/utils/hmr$": "<rootDir>/test/ts/__mocks__/mdPreviewHmrMock.cjs",
"^@n-apt/md-preview/(.*)$": "<rootDir>/src/md-preview/$1",
"^@n-apt/components/(.*)$": "<rootDir>/src/ts/components/$1",
"^@n-apt/hooks/(.*)$": "<rootDir>/src/ts/hooks/$1",
// Stub like other static assets: alias must not point at raw .svg or Jest parses XML as JS.
"^@n-apt/public/(.*)$": "<rootDir>/test/ts/__mocks__/fileMock.cjs",
"^@n-apt/(.*)$": "<rootDir>/src/ts/$1",
"\\.(gif|jpg|jpeg|png|svg|webp)$": "<rootDir>/test/ts/__mocks__/fileMock.cjs",
"\\.css$": "<rootDir>/test/ts/__mocks__/styleMock.cjs",
},
testMatch: [
"<rootDir>/test/ts/**/*.test.ts",
"<rootDir>/test/ts/**/*.test.tsx",
"<rootDir>/test/integration/**/*.test.ts",
"<rootDir>/test/integration/**/*.test.tsx"
],
testPathIgnorePatterns: [
"/node_modules/",
"/.shared-worktree-cache/"
],
collectCoverageFrom: [
"src/**/*.{ts,tsx}",
"!src/**/*.d.ts",
"!src/main.tsx",
"!src/vite-env.d.ts",
"!src/workers/**/*", // Skip workers from coverage - run in separate contexts
"!src/**/*stories.tsx", // Skip Storybook stories - documentation only
"!src/encrypted-modules/**/*", // Skip encrypted/temporary modules
],
coverageThreshold: {
global: {
branches: 20,
functions: 24,
lines: 33,
statements: 33,
},
// Key utilities should have high coverage
'src/ts/utils/frequency.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
'src/ts/utils/centerFrequency.ts': {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
'src/ts/utils/webgpu.ts': {
branches: 40,
functions: 50,
lines: 70,
statements: 70,
},
'src/ts/utils/gpuMemoryManager.ts': {
branches: 58,
functions: 75,
lines: 70,
statements: 70,
},
},
transform: {
"^.+\\.(ts|tsx)$": "<rootDir>/scripts/test/ts-jest-typescript6.cjs",
"\\.wgsl$": "jest-transform-stub"
},
transformIgnorePatterns: ["node_modules/(?!(.*\\.mjs$|@chenglou/pretext))"],
modulePathIgnorePatterns: ["<rootDir>/.shared-worktree-cache/"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
};