simplecov icon indicating copy to clipboard operation
simplecov copied to clipboard

Minimum coverage by group check

Open mikhliuk-k opened this issue 1 year ago • 9 comments

I added support for coverage checking by group since we needed it for our project and noticed there was an open issue about it. This feature is useful as we’re gradually increasing test coverage across our app, so we can enforce coverage checks on specific parts. Here’s an example of how to use it from the README.

SimpleCov.minimum_coverage_by_group 'Models' => 80, 'Controllers' => 60
# same as above (the default is to check line coverage)
SimpleCov.minimum_coverage_by_group 'Models' => { line: 80 }, 'Controllers' => { line: 60 }
# check for a minimum line and branch coverage for 'Models' and 'Controllers' groups
SimpleCov.minimum_coverage_by_group 'Models' => { line: 90, branch: 80 }, 'Controllers' => { line: 60, branch: 50 }

mikhliuk-k avatar Aug 29 '24 11:08 mikhliuk-k

Lovely! This is also helpful when enabling the new coverage for eval. So we can enable coverage for erb files without dropping the global coverage.

coorasse avatar Sep 18 '24 06:09 coorasse

This would be a very welcome change indeed!

cb341 avatar Sep 27 '24 11:09 cb341

Any updates regarding this pull request?

cb341 avatar Nov 18 '24 11:11 cb341

@PragTob This additional functionality for setting minimum coverage by group would be very valuable. We're currently restructuring our Rails monolith to group functionality via Packwerk packages, allowing us to track overall coverage as well as per-package coverage separately via groups. Being able to systematically ratchet down coverage requirement on a per-package basis would be amazing. Would you mind looking into this PR?

jebentier avatar Dec 17 '24 15:12 jebentier

@PragTob @amatsuda hey guys, any chance it can be reviewed and merged?

YegorZdanovich avatar Feb 14 '25 13:02 YegorZdanovich

WANT

aguynamedben avatar Aug 04 '25 08:08 aguynamedben

That'd be an awesome feature.

viralpraxis avatar Aug 15 '25 22:08 viralpraxis

What's the state of this PR? Would be super cool

cb341 avatar Nov 06 '25 16:11 cb341

Hey @amatsuda, what's blocking this PR from being merged?

denblackstache avatar Nov 12 '25 16:11 denblackstache