-
Notifications
You must be signed in to change notification settings - Fork 225
[coverage] Support workspaces in coverage filters #2574
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
Conversation
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
| final pubspec = Pubspec.parse(yaml, sourceUrl: pubspecUri); | ||
| results.add(pubspec.name); | ||
| for (final workspace in pubspec.workspace ?? <String>[]) { | ||
| _getAllWorkspaceNames(packageRoot.resolve('$workspace/'), results); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be recursive? Each package in a workspace should only contribute one package to the set...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workspaces can contain workspaces, and can form a tree. I asked the pub folks about this edge case when I was building this feature for package:coverage, and they said it's an intended (though uncommon) use case.
Co-authored-by: Nate Bosch <nbosch@google.com>
Fixes dart-lang/tools#2269
The bug is that when
dart test --coverage...is run in a package that's part of a workspace, the default coverage filter is set to the name of the workspace, rather than the package under test. Inpackage:coverageI solved this by searching for all the nested packages, and using those as the default filter. Another approach would be to restrict the default filter to only include the package under test, but I think users are more likely to want all the workspace's packages included in the report.This change introduces a dependency on
package:pubspec_parse. Hopefully that's ok.