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

@@ -34,8 +34,8 @@ jobs:
run: |
uv run alembic upgrade head
uv run alembic check
- name: pytest
run: uv run pytest -q
- name: pytest + coverage gate (>=80%)
run: uv run pytest -q --cov --cov-report=term-missing --cov-fail-under=80
# 打包冒烟:构建 ww-agents wheel → 装进裸 venv → import ww_agents 并断言 SPECS。
# 证明 prompts/*.md 随 wheel 分发(源码树 pytest 测不出此漏带——见
@@ -85,6 +85,6 @@ jobs:
- name: typecheck
working-directory: apps/web
run: pnpm typecheck
- name: test
- name: test + coverage gate (>=80%)
working-directory: apps/web
run: pnpm test
run: pnpm test:coverage