Files
everything-claude-code/docs/zh-CN/commands/test-coverage.md
zdoc 88054de673 docs: Add Chinese (zh-CN) translations for all documentation
* docs: add Chinese versions docs

* update

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
2026-02-05 05:57:54 -08:00

29 lines
666 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 测试覆盖率
分析测试覆盖率并生成缺失的测试:
1. 运行带有覆盖率的测试npm test --coverage 或 pnpm test --coverage
2. 分析覆盖率报告 (coverage/coverage-summary.json)
3. 识别覆盖率低于 80% 阈值的文件
4. 对于每个覆盖率不足的文件:
* 分析未测试的代码路径
* 为函数生成单元测试
* 为 API 生成集成测试
* 为关键流程生成端到端测试
5. 验证新测试通过
6. 显示覆盖率指标的前后对比
7. 确保项目整体覆盖率超过 80%
重点关注:
* 正常路径场景
* 错误处理
* 边界情况null、undefined、空值
* 边界条件