后端: 加 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。
75 lines
1.5 KiB
TOML
75 lines
1.5 KiB
TOML
[tool.uv.workspace]
|
||
members = [
|
||
"apps/api",
|
||
"packages/shared",
|
||
"packages/config",
|
||
"packages/db",
|
||
"packages/llm_gateway",
|
||
"packages/core",
|
||
"packages/agents",
|
||
"packages/skills",
|
||
]
|
||
|
||
[dependency-groups]
|
||
dev = [
|
||
"pytest>=8",
|
||
"pytest-asyncio>=0.24",
|
||
"pytest-cov>=5",
|
||
"ruff>=0.6",
|
||
"mypy>=1.11",
|
||
"httpx>=0.27",
|
||
"asgi-lifespan>=2.1",
|
||
]
|
||
|
||
[tool.ruff]
|
||
line-length = 100
|
||
target-version = "py312"
|
||
src = ["apps", "packages"]
|
||
|
||
[tool.ruff.lint]
|
||
select = ["E", "F", "I", "UP", "B"]
|
||
|
||
[tool.mypy]
|
||
python_version = "3.12"
|
||
mypy_path = [
|
||
"packages/shared",
|
||
"packages/config",
|
||
"packages/db",
|
||
"packages/llm_gateway",
|
||
"packages/core",
|
||
"packages/agents",
|
||
"packages/skills",
|
||
"apps/api",
|
||
]
|
||
namespace_packages = true
|
||
strict = true
|
||
ignore_missing_imports = true
|
||
explicit_package_bases = true
|
||
# 跨包聚合 mypy 时,多个无包 tests 目录的 conftest.py 会撞成同名模块 `conftest`。
|
||
# conftest 仅含测试 fixtures;从聚合检查中排除(test_*.py / fakes_* 仍按唯一名受检)。
|
||
exclude = ["(^|/)conftest\\.py$"]
|
||
|
||
[tool.pytest.ini_options]
|
||
asyncio_mode = "auto"
|
||
testpaths = ["tests", "apps", "packages"]
|
||
|
||
[tool.coverage.run]
|
||
branch = true
|
||
source = ["apps", "packages"]
|
||
omit = [
|
||
"*/tests/*",
|
||
"*/conftest.py",
|
||
"*/migrations/*",
|
||
"*/alembic/*",
|
||
]
|
||
|
||
[tool.coverage.report]
|
||
show_missing = true
|
||
# 排除无需覆盖的纯防御/类型分支
|
||
exclude_lines = [
|
||
"pragma: no cover",
|
||
"raise NotImplementedError",
|
||
"if TYPE_CHECKING:",
|
||
"@(abc\\.)?abstractmethod",
|
||
]
|