🌱 Enable cross-package coverage #2024
Merged
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.
By default coverage only is accounted for LoC in the same package as the tests.
If you provide
-coverpkgyou can specify a list of packages that will be taken into account when creating the coverage report.This allows tests in a package to be used to provide coverage for other packages in the provided list.
Impact on covered files
As a side-effect, the list of files that are being covered is slightly different.
The following files were considered previously by coverage and are no longer:
pkg/plugins/golang/v2/api.gopkg/plugins/golang/v2/edit.gopkg/plugins/golang/v2/init.gopkg/plugins/golang/v2/options.gopkg/plugins/golang/v2/plugin.gopkg/plugins/golang/v2/webhook.goAll of them, exept for
pkg/plugins/golang/v2/options.gowere not being tested and had a 0% coverage, as this is being tested with integration tests. Loosing coverage onpkg/plugins/golang/v2/options.gowhich is at a 96.5% covered doesn't seem to big of an issue. Additionally, this file is going to disapear in plugin phase 1.5.On the other hand, files that were not considered previously by coverage are being taken into account now:
pkg/internal/validation/dns.gopkg/model/file/errors.gopkg/model/file/funcmap.gopkg/model/file/marker.gopkg/model/file/mixins.gopkg/model/plugin.gopkg/model/universe.gopkg/plugins/internal/cmdutil/cmdutil.goSo summing up, we are just removing coverage from a file that is going to disapear and currently has 96.5% to add 8 new files that will stay and were not covered before.