-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.ui.config.js
More file actions
43 lines (43 loc) · 1.32 KB
/
jest.ui.config.js
File metadata and controls
43 lines (43 loc) · 1.32 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
/** @type {import('jest').Config} */
export default {
preset: "ts-jest/presets/default-esm",
testEnvironment: "jsdom",
extensionsToTreatAsEsm: [".ts", ".tsx"],
testMatch: ["<rootDir>/tests/ui/**/*.test.tsx", "<rootDir>/tests/ui/**/*.spec.tsx"],
collectCoverageFrom: [
"src/**/*.{ts,tsx}",
"!src/**/*.d.ts",
"!src/main.tsx",
"!src/vite-env.d.ts",
"!src/components/ui/**/*.{ts,tsx}", // Exclude shadcn components
],
setupFilesAfterEnv: ["<rootDir>/tests/ui-setup.ts"],
testTimeout: 10000,
maxWorkers: "50%",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
verbose: true,
// Handle module mapping and static assets
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"\\.(css|less|scss)$": "identity-obj-proxy",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/tests/__mocks__/fileMock.js",
},
transform: {
"^.+\\.tsx?$": [
"ts-jest",
{
useESM: true,
tsconfig: "./tsconfig.test.json",
},
],
},
// Configure jsdom to handle React 18 concurrent features
testEnvironmentOptions: {
customExportConditions: ["node", "node-addons"],
},
// Suppress React 18 act warnings in tests (they're expected in async components)
globals: {
IS_REACT_ACT_ENVIRONMENT: true,
},
};