Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum coverage by group check #1105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikhliuk-k
Copy link

@mikhliuk-k mikhliuk-k commented Aug 29, 2024

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 mikhliuk-k force-pushed the minimum_coverage_by_group branch from 37f41fc to 539a61f Compare September 2, 2024 21:43
@mikhliuk-k mikhliuk-k changed the title wip Minimum coverage by group check Sep 2, 2024
@mikhliuk-k mikhliuk-k force-pushed the minimum_coverage_by_group branch 4 times, most recently from ace4fb8 to 4846449 Compare September 2, 2024 22:31
@mikhliuk-k mikhliuk-k marked this pull request as ready for review September 2, 2024 22:45
@mikhliuk-k mikhliuk-k force-pushed the minimum_coverage_by_group branch from 4846449 to f17969d Compare September 2, 2024 22:56
@mikhliuk-k mikhliuk-k force-pushed the minimum_coverage_by_group branch from f17969d to c7835b5 Compare September 2, 2024 22:57
@coorasse
Copy link

coorasse commented Sep 18, 2024

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.

@CuddlyBunion341
Copy link

This would be a very welcome change indeed!

@CuddlyBunion341
Copy link

Any updates regarding this pull request?

@jebentier
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants