-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
101 lines (94 loc) · 2.72 KB
/
Copy pathvitest.config.ts
File metadata and controls
101 lines (94 loc) · 2.72 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
import { fileURLToPath } from 'node:url'
import { mergeConfig, defineConfig, configDefaults } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
defineConfig({
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./test/setup.ts'],
exclude: [...configDefaults.exclude, 'e2e/**'],
root: fileURLToPath(new URL('./', import.meta.url)),
reporters: [['verbose', { summary: true }]],
// Timeouts optimizados
testTimeout: 10000,
hookTimeout: 10000,
// Configuración de coverage mejorada
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
// Lista de exclusiones mejorada basada en mejores prácticas 2024/2025
exclude: [
'node_modules/',
'test/',
'**/*.d.ts',
'**/*.config.*',
'**/coverage/**',
'dist/',
'build/',
'public/',
// Patrones específicos para proyectos Vue
'**/*.stories.{js,jsx,ts,tsx}',
'**/*.story.{js,jsx,ts,tsx}',
'**/mock/**',
'**/mocks/**',
'**/__mocks__/**',
'**/test-utils/**',
'**/factories/**',
'**/fixtures/**',
// Archivos de configuración específicos
'vite.config.ts',
'vitest.config.ts',
'tsconfig.json',
'tsconfig.*.json',
'eslint.config.js',
// Archivos de entrada
'src/main.ts',
'src/App.vue',
// Archivos de tipos y constantes
'**/types.ts',
'**/constants.ts',
'**/index.ts', // Solo exports
// Archivos de estilo
'**/*.scss',
'**/*.sass',
],
// Thresholds más realistas para proyectos en desarrollo
thresholds: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70
}
}
},
// Configuración de deps.optimizer simplificada
deps: {
optimizer: {
web: {
enabled: true,
include: [
// Solo dependencias que realmente existen en el proyecto
'@vue/test-utils',
'@testing-library/vue',
'@testing-library/user-event',
'@pinia/testing',
'element-plus',
'@element-plus/icons-vue',
'@vueuse/core',
],
},
},
},
// Configuración de entorno mejorada
environmentOptions: {
jsdom: {
resources: 'usable',
runScripts: 'dangerously',
}
},
},
})
)