3 ms·
Ask HN: Do you enforce a unit test code coverage % in your CI/CD pipeline?
Previously I've never enforced unit testing, I wrote a lot myself and encouraged others to but didn't require it in code reviews. However my current team is much smaller and all onboard with doing TDD.
I understand the metric can be flakey and I'm not aiming for 100% but would like to know what number others aim for at and if you enforce it during code review or in CI/CD?
- byoung2 7y agoWe don't enforce a % but new functionality won't pass code review without tests added. A previous company I worked for required 90% coverage enforced in CI/CD. It got annoying sometimes to refactor code so you could test every logic branch.
- jamil7 7y agoDo you enforce that automatically? or is it just part of the review process?
- byoung2 7y agoAt my current company, just part of the review process people will not approve your PR if there are no tests. My last company enforced it in CI and you could not merge if there was less than 90% coverage.
- clintonb 7y agoWe don’t have any automatic enforcement at my current company. At edX, and on personal projects, we used Codecov to enforce 95% coverage on all new code, and 95% coverage across the entire repo. The exact numbers varied with the current state of the repo, but this was the default for all new repos. While the number was high, we did recognize when testing might cost more than it benefitted is, so we occasionally used comments to ignore coverage of some branches.