Code Coverage Threshold - CI/CD用語集の定義
code coverage thresholdとは、テストスイートが満たすべき最小のカバレッジ割合で、CIで強制され、カバレッジが設定された基準を下回るとbuildが失敗します。
設定方法
JestではcoverageThresholdをメトリクスごとの最小値(statements、branches、functions、lines)で設定します。Codecovのようなツールは、base branchと比較してカバレッジを下げるPRを不合格にできます。
慎重に使う
厳格なthresholdは後退を防ぎますが、数値を満たすためだけに書かれた価値の低いテストを助長することがあります。branch coverageと、理想的にはmutation scoreと組み合わせて、実際のアサーションの質を測定しましょう。
関連ガイド
Branch Coverage - CI/CD Glossary DefinitionBranch Coverage: Branch coverage measures the percentage of decision branches (each side of every `if`, `swit…
Mutation Score - CI/CD Glossary DefinitionMutation Score: A mutation score is the percentage of injected code mutations (deliberate bugs) that a test s…
Smoke Test - CI/CD Glossary DefinitionSmoke Test: A smoke test is a small, fast check that verifies the most critical paths work at all, run right…