Skip to content

Conversation

@liamappelbe
Copy link
Contributor

@liamappelbe liamappelbe commented Nov 25, 2025

At the moment dart test only ever gathers coverage data for the current package. But sometimes part of out test coverage comes from other packages, especially in the case of monorepos.

To handle this case, flutter test has a --coverage-package option, which is a multi-option of RegExps. When this option is present, we list all the transitive packages the current package depends on, and include them in the coverage report if they match any of the RegExps.

This PR adds the exact same flag to dart test.

Fixes dart-lang/sdk#60958

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@liamappelbe liamappelbe changed the title WIP: --coverage-package Add --coverage-package option Nov 25, 2025
@liamappelbe liamappelbe marked this pull request as ready for review November 25, 2025 03:44
@liamappelbe liamappelbe requested a review from a team as a code owner November 25, 2025 03:44
@liamappelbe liamappelbe merged commit bbad7a2 into master Nov 26, 2025
59 checks passed
@liamappelbe liamappelbe deleted the coverage_filter branch November 26, 2025 00:07
@DanTup
Copy link
Contributor

DanTup commented Nov 26, 2025

@liamappelbe thank you! 🙂

Do you have an idea of when the next pkg:test release might be? (not a request to do one now, but I'd prefer to implement this once it's available so I can ensure I gate it correctly on the version that includes it).

@liamappelbe
Copy link
Contributor Author

@liamappelbe thank you! 🙂

Do you have an idea of when the next pkg:test release might be? (not a request to do one now, but I'd prefer to implement this once it's available so I can ensure I gate it correctly on the version that includes it).

That's up to @natebosch. From my end, I'm fine publishing this asap.

@natebosch
Copy link
Member

I have a few more changes I'd like to get out that have been slow to land internally. I expect I should have a release ready sometime next week.

@DanTup
Copy link
Contributor

DanTup commented Dec 3, 2025

sgtm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support coverage from "dart test" in lcov format to match "flutter test", and make the output locations more consistent

3 participants