60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
import { defineConfig } from 'vitest/config';
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// 测试环境
|
|
environment: 'node',
|
|
|
|
// 测试文件匹配模式
|
|
include: ['tests/**/*.test.js'],
|
|
|
|
// 排除文件
|
|
exclude: ['node_modules/**', 'coverage/**'],
|
|
|
|
// 全局设置
|
|
globals: true,
|
|
|
|
// 覆盖率配置
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html', 'lcov'],
|
|
reportsDirectory: 'coverage',
|
|
include: ['src/**/*.js'],
|
|
exclude: [
|
|
'tests/**',
|
|
'node_modules/**',
|
|
'coverage/**'
|
|
],
|
|
// 覆盖率阈值
|
|
thresholds: {
|
|
lines: 80,
|
|
functions: 80,
|
|
branches: 70,
|
|
statements: 80
|
|
}
|
|
},
|
|
|
|
// 测试超时设置
|
|
testTimeout: 10000,
|
|
|
|
// 钩子超时设置
|
|
hookTimeout: 10000,
|
|
|
|
// 并发设置
|
|
pool: 'threads',
|
|
poolOptions: {
|
|
threads: {
|
|
singleThread: false
|
|
}
|
|
},
|
|
|
|
// 监听模式配置
|
|
watch: false,
|
|
|
|
// 报告器配置
|
|
reporter: ['verbose'],
|
|
|
|
// 设置文件
|
|
setupFiles: ['tests/setup/global-setup.js']
|
|
}
|
|
}); |