test-coverage
它能做什么
这项技能为软件项目设置测试覆盖率的下限。适用于希望代码长期保持良好测试的开发者和团队负责人。
适用场景
- ✓当项目没有最低测试覆盖率规则的时候。
- ✓当覆盖率设置已存在,但在构建过程中没有检查的时候。
- ✓当团队希望在测试覆盖的代码不足时让构建失败的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/test-coverage/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的项目有测试,但没有任何机制阻止覆盖率下降。请帮我设置能阻止构建的最低标准。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在测试工具中设置最低覆盖率数值,并在构建中加入检查。如果覆盖率低于下限,构建就会失败。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Maintain test coverage thresholds
Coverage thresholds prevent code quality from degrading over time by failing builds when test coverage drops below safe levels.
Quick Reference
- Set global thresholds: 70% branches, 80% lines/functions/statements
- Apply stricter thresholds (90%+) to critical utility code
- Exclude generated code, type definitions, and config files
- Focus on meaningful coverage—test behavior, not just lines
Check
Review this project's test coverage configuration to ensure minimum thresholds are set and enforced in CI/CD.
Fix
Configure coverage thresholds in Jest, Vitest, or your testing framework, and add coverage checks to CI/CD.
Explain
Explain how to set up test coverage thresholds and what coverage levels are appropriate for different types of code.
Code Review
Review tests, CI workflows, and enforcement points related to Maintain test coverage thresholds. Flag exact gaps where the rule is not automatically verified or where failures do not block regressions.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/testing/test-coverage
常见问题
这项技能建议什么覆盖率水平?
它建议分支覆盖率约 70%,行、函数和语句覆盖率约 80%,关键代码应设置更严格的标准。
它支持哪些工具?
这项技能提到了 Jest、Vitest 和其他测试框架。
我应该测试每一行吗?
不需要。这项技能指出,应专注于对行为的有意义测试,而不是只为了达到某个数字。
详情
作者的原始描述
Use when reviewing CI coverage, automated checks, or test strategy related to Maintain test coverage thresholds. Focus on whether the rule is continuously verified, not just documented.
热度
- GitHub 星标
- 75k
- 排名
- #3051
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。