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
| // vitest.config.ts
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
test: {
// 测试环境
environment: 'jsdom',
// 全局配置
globals: true,
setupFiles: ['./test/setup.ts'],
// 覆盖率
coverage: {
provider: 'v8', // v8或istanbul
reporter: ['text', 'json', 'html'],
include: ['src/**/*.{js,jsx,ts,tsx}'],
exclude: ['src/**/*.d.ts', 'src/**/*.stories.*'],
thresholds: {
lines: 80,
functions: 80,
branches: 80,
statements: 80
}
},
// include/exclude
include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
// 并行
threads: true,
maxThreads: 4,
minThreads: 1
},
// 解析配置(继承自vite)
resolve: {
alias: {
'@': '/src',
'@/components': '/src/components'
}
}
})
|