This commit is contained in:
2026-10-21 14:42:59 +08:00
commit 954236d3f9
399 changed files with 85885 additions and 0 deletions

48
vitest.config.ts Normal file
View File

@@ -0,0 +1,48 @@
// vitest.config.ts
import { defineConfig } from 'vitest/config';
import { resolve } from 'path';
export default defineConfig({
test: {
globals: true,
environmentMatchGlobs: [
['src/renderer/**', 'jsdom'],
['tests/unit/renderer/**', 'jsdom'],
],
setupFiles: ['./tests/setup.ts'],
include: ['tests/**/*.test.{ts,tsx}'],
exclude: ['node_modules', 'dist'],
coverage: {
provider: 'v8',
reporter: ['text', 'text-summary', 'html', 'lcov'],
include: ['src/**/*.ts', 'src/**/*.tsx'],
// 入口文件 / 进程引导几乎不可测,排除
exclude: [
'src/main/index.ts',
'src/main/startup.ts',
'src/preload/index.ts',
// 类型声明文件
'src/**/*.d.ts',
],
// audit round 8 (2026-09-14):阈值上调 —— r5–r7 收口后基线从 1968 → 1991 tests。
// 实测 stmts/lines 55.38,branches 88.24,functions 81.48 —— 目标 60/80/75/60,
// branches / functions 已超线,stmts/lines 距 60 差 4.6pp。需要给主进程
// scanner / standalone 等大文件补测试才能跨过 60。本轮先把阈值定到
// 56(略高于当前实测,作为后续补测的目标水位),branches / functions
// 保持 80 / 75 收紧新代码。下一轮迭代再上 60。
thresholds: {
lines: 55,
branches: 80,
functions: 75,
statements: 55,
},
},
},
resolve: {
alias: {
'@shared': resolve(__dirname, 'src/shared'),
'@main': resolve(__dirname, 'src/main'),
'@renderer': resolve(__dirname, 'src/renderer/src'),
},
},
});