-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvitest.config.ts
More file actions
106 lines (92 loc) · 3.56 KB
/
vitest.config.ts
File metadata and controls
106 lines (92 loc) · 3.56 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import path from 'path'
export default defineConfig({
plugins: [
react(),
tsconfigPaths({
root: __dirname,
projects: ['./tsconfig.test.json'],
}),
],
test: {
environment: 'happy-dom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
root: __dirname,
// Isolation
isolate: true,
sequence: { shuffle: false },
fileParallelism: true,
exclude: ['**/node_modules/**', '**/dist/**', '**/worktrees/**', '**/assets/**'],
alias: {
'framer-motion': path.resolve(__dirname, 'src/shared/lib/test-utils/mocks/framer-motion.tsx'),
sonner: path.resolve(__dirname, 'src/shared/lib/test-utils/mocks/sonner.tsx'),
// Force Node.js entry for brotli-wasm (web entry uses fetch for WASM loading)
'brotli-wasm': path.resolve(__dirname, 'node_modules/brotli-wasm/index.node.js'),
},
// MINIMAL coverage config
coverage: {
provider: 'istanbul',
reporter: ['text', 'json', 'html'],
reportsDirectory: './coverage',
// Simple pattern without **/ prefix
include: ['src/**/*.ts', 'src/**/*.tsx'],
exclude: [
'node_modules/**',
'**/*.d.ts',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/index.ts',
'**/index.tsx',
// === Type definitions only (no runtime code) ===
'**/types.ts',
'**/model/types.ts',
// === Static constants (no logic to test) ===
'**/constants.ts',
'**/constants/**',
'src/shared/ui/constants/**',
'src/widgets/landing/constants/**',
'src/widgets/network-background/lib/constants.ts',
'src/entities/invoice/lib/constants.ts',
// === Test infrastructure (testing the tests) ===
'src/shared/test-utils/**',
'src/shared/lib/test-utils/**',
'**/invoice-fixtures.ts',
'**/invoice-generator.ts',
// === Environment config (env vars, URLs) ===
'src/shared/config/env.ts',
'src/shared/config/urls.ts',
'src/shared/config/storage-keys.ts',
// === Next.js pages (tested via E2E/Playwright) ===
'src/app/**/page.tsx',
'src/app/layout.tsx',
'src/app/error.tsx',
// === OG image generation (edge runtime, Vercel-specific) ===
'src/app/og-image-utils.tsx',
'src/app/opengraph-image.tsx',
'src/app/twitter-image.tsx',
// === SVG generators (visual output, no logic) ===
'src/widgets/network-background/lib/svg-generators.ts',
// === Remotion video compositions (visual output, tested via Studio review) ===
// Scenes/components render Remotion primitives at frame-time; not unit-testable in vitest.
// Excluding to surface true app-code coverage (~81%) instead of diluted 74% total.
'src/video/**',
// WebGL/canvas code - requires canvas environment, tested via E2E
'**/network-background/lib/generate-shapes.ts',
'**/network-background/lib/calculate-shapes.ts',
'**/network-background/NetworkBackground.tsx',
// Complex landing components with dynamic imports
'**/landing/ui/LandingContent.tsx',
'**/landing/ui/BelowFoldSections.tsx',
// Shape generators (canvas-dependent)
'**/network-background/lib/shape-generators.ts',
// Hook using matchMedia (testing environment limitations)
'**/hooks/use-reduced-motion.ts',
],
},
},
})