-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvitest.config.mjs
More file actions
81 lines (78 loc) · 2.14 KB
/
vitest.config.mjs
File metadata and controls
81 lines (78 loc) · 2.14 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
/// <reference types="vitest" />
import path from 'path'
import { fileURLToPath } from 'url'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vitest/config'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setup.ts'],
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/tests/e2e/**', // Exclude Playwright e2e tests
],
// Test configuration optimizations
testTimeout: 10000,
hookTimeout: 10000,
teardownTimeout: 5000,
// Improved test isolation
isolate: true,
// Pool configuration for better performance
pool: 'threads',
poolOptions: {
threads: {
singleThread: false,
isolate: true,
},
},
// Coverage configuration
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'coverage/**',
'dist/**',
'packages/*/test{,s}/**',
'**/*.d.ts',
'cypress/**',
'test{,s}/**',
'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
'prisma/**',
'**/.next/**',
'**/node_modules/**',
],
},
// Allow TypeScript checking with better error handling
typecheck: {
enabled: false, // Keep disabled for now due to Prisma client generation issues
},
// Better error reporting
reporters: ['verbose'],
// Mock configuration
clearMocks: true,
restoreMocks: true,
unstubEnvs: true,
unstubGlobals: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './'),
},
},
// Define for better compatibility
define: {
'import.meta.vitest': undefined,
},
})