Files
BIPMaterialManager/vitest.config.ts
ERPAuto Bot 5d8563a4c9 docs: add P0 summary report and update README with test docs
- Add comprehensive P0 summary report (.sisyphus/evidence/p0-summary.md)
- Update README.md with test infrastructure links and examples
- Add coverage thresholds to vitest.config.ts (global 70%, core 80%)
- Document 41.5% performance improvement (7.65s → 4.49s)

Related: test-optimization-p0 task-18
2026-04-04 20:46:46 +08:00

53 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import path from 'path'
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['tests/**/*.{test,spec}.{ts,tsx}'],
exclude: ['node_modules', 'dist', 'out', 'tests/e2e'],
setupFiles: ['tests/setup.ts'],
env: {
NODE_ENV: 'test'
},
// 性能优化配置
isolate: false, // 禁用隔离(提升 30-50% 速度)
pool: 'threads', // 使用线程池
maxWorkers: 4,
bail: process.env.CI ? 1 : undefined,
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
thresholds: {
global: {
branches: 60,
functions: 70,
lines: 70,
statements: 70
},
'src/main/services/erp/**': {
branches: 70,
functions: 80,
lines: 80,
statements: 80
},
'src/main/services/update/**': {
branches: 70,
functions: 80,
lines: 80,
statements: 80
}
}
}
},
resolve: {
alias: {
'@main': path.resolve(__dirname, './src/main'),
'@services': path.resolve(__dirname, './src/main/services'),
'@types': path.resolve(__dirname, './src/main/types'),
'@': path.resolve(__dirname, './src')
}
}
})