chore: exclude barrel files from coverage reporting#315
Merged
kurtdoherty merged 1 commit intomainfrom Feb 13, 2025
Merged
Conversation
853eb95 to
73d28ec
Compare
1 task
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
ksolanki7
approved these changes
Feb 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
In some recent work, we saw the addition of test coverage for a barrel file (a file, usually named
index.ts, that simply re-exports code from other modules) in order to increase the reported coverage percentage above our minimum threshold.As the discussion suggests, doing this is just "gaming the system." We don't want to add tests for the sake of our coverage metrics as that approach will lead to low-value, high-maintenance tests, and undermine the value coverage metrics are meant to provide: namely, the identification of possible risk in our code.
Instead of simply adding test coverage against a module that does not need tests (like barrel files), we should be assessing whether there's any meaningful coverage gaps being reported. Barrel files are not a meaningful gap.
This PR
Currently, our coverage metrics are tracking coverage for barrel files. These files will never have test coverage, so we they should not be included in our coverage reports.
The risk of excluding all
index.tsfiles is that we do not strictly know whether the file is a barrel file, or if it does contain code we want coverage metrics for. Personally, I don't think this risk outweighs the annoyance of barrel files dragging our real coverage metrics down and would prefer to rely on the convention thatindex.tsfiles should only ever be barrel files.This PR also scouts two issues with the recent Chip/ChipGroup work:
onClickcallback being called when the chip is enabled.