test: 接入覆盖率工具并在 CI 强制 ≥80% 门禁

后端: 加 pytest-cov + [tool.coverage] 配置, pytest --cov-fail-under=80 (基线~88%)。
前端: 加 @vitest/coverage-v8, vitest.config.ts 设 80% 阈值, 新增 test:coverage 脚本 (基线~93%)。
前端覆盖范围限定 lib/** 纯逻辑层; hooks(use*.ts)待 jsdom 测试栈接入后纳入。
CI backend/frontend job 改跑覆盖率门禁命令。CLAUDE.md 同步 DoD 与 Toolchain。
This commit is contained in:
Yaojia Wang
2026-06-26 21:11:57 +02:00
parent e9477d84d8
commit a02c6b6e4f
7 changed files with 562 additions and 68 deletions

View File

@@ -9,9 +9,11 @@
"lint": "next lint",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"gen:api": "node scripts/gen-api.mjs"
},
"dependencies": {
"lucide-react": "^1.21.0",
"next": "15.1.3",
"openapi-fetch": "^0.13.0",
"react": "19.0.0",
@@ -21,10 +23,12 @@
"@types/node": "^22.10.0",
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0",
"@vitest/coverage-v8": "^2.1.9",
"autoprefixer": "^10.4.20",
"eslint": "^9.17.0",
"eslint-config-next": "15.1.3",
"openapi-typescript": "^7.5.0",
"playwright": "^1.61.1",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",