fix(coverage): exclude linked/patched packages from coverage report#34834
Merged
Conversation
Packages brought in via the "links" (formerly "patch") feature are third-party dependencies replacing a registry version, so they should not appear in the user's coverage report, the same way npm packages are already excluded. Before this change, running "deno test --coverage" in a project using "links" reported coverage for the linked package's files (e.g. patch/jsr.io/@luca/flag/1.0.1/main.ts), skewing the totals. filter_coverages now also drops any coverage entry whose URL is under one of the workspace's link folders. Fixes #29391
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.
Running
deno test --coveragein a project that uses thelinks(formerlypatch) feature included the linked package's files in the coverage report.For example, a project linking
@luca/flagsaw an entry likepatch/jsr.io/@luca/flag/1.0.1/main.tswith low coverage, which also skewedthe "All files" totals.
Linked/patched packages are third-party dependencies that replace a registry
version, so they should be excluded from the user's coverage report the same way
npm packages already are.
filter_coveragesnow drops any coverage entry whoseURL falls under one of the workspace's link folders, which it gets from
Workspace::link_folders().Added a spec test under
tests/specs/coverage/patched_package_excludedthatlinks a local
@denotest/flagpackage, runsdeno test --coverage, and assertsthe lcov report contains only the user's
main.ts. The test was confirmed tofail before the change (the linked
flag/mod.tsappeared) and pass after.Fixes #29391