From 38e16d473a357fe9cc01114b293fb993309c3d3e Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Mon, 6 May 2024 13:15:40 +1200 Subject: [PATCH 1/2] Copy collect_coverage's `--scope-output` flag to test_with_coverage. --- CHANGELOG.md | 4 ++++ bin/test_with_coverage.dart | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae6cda22..49da1508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.7.3 + +- Copy collect_coverage's `--scope-output` flag to test_with_coverage. + ## 1.7.2 - Update `package:vm_service` constraints to '>=12.0.0 <15.0.0'. diff --git a/bin/test_with_coverage.dart b/bin/test_with_coverage.dart index d234527f..010e6089 100644 --- a/bin/test_with_coverage.dart +++ b/bin/test_with_coverage.dart @@ -80,6 +80,10 @@ ArgParser _createArgParser() => ArgParser() defaultsTo: false, help: 'Collect branch coverage info.', ) + ..addMultiOption('scope-output', + help: 'restrict coverage results so that only scripts that start with ' + 'the provided package path are considered. Defaults to the name of ' + 'the package under test.') ..addFlag('help', abbr: 'h', negatable: false, help: 'Show this help.'); class Flags { @@ -90,7 +94,8 @@ class Flags { this.port, this.testScript, this.functionCoverage, - this.branchCoverage, { + this.branchCoverage, + this.scopeOutput, { required this.rest, }); @@ -101,6 +106,7 @@ class Flags { final String testScript; final bool functionCoverage; final bool branchCoverage; + final List scopeOutput; final List rest; } @@ -154,6 +160,7 @@ ${parser.usage} args['test'] as String, args['function-coverage'] as bool, args['branch-coverage'] as bool, + args['scope-output'] as List, rest: args.rest, ); } @@ -195,11 +202,13 @@ Future main(List arguments) async { ); final serviceUri = await serviceUriCompleter.future; + final scopes = + flags.scopeOutput.isEmpty ? [flags.packageName] : flags.scopeOutput; await collect_coverage.main([ '--wait-paused', '--resume-isolates', '--uri=$serviceUri', - '--scope-output=${flags.packageName}', + for (final scope in scopes) '--scope-output=$scope', if (flags.branchCoverage) '--branch-coverage', if (flags.functionCoverage) '--function-coverage', '-o', From b819b58dfc3183eb764e7ab9a9e0b34edfbbaa2a Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Mon, 6 May 2024 13:37:03 +1200 Subject: [PATCH 2/2] Fix semver --- CHANGELOG.md | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49da1508..4a2a711e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.7.3 +## 1.8.0 - Copy collect_coverage's `--scope-output` flag to test_with_coverage. diff --git a/pubspec.yaml b/pubspec.yaml index 2a0553b4..6a443ac0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: coverage -version: 1.7.2 +version: 1.8.0 description: Coverage data manipulation and formatting repository: https://github.com/dart-lang/coverage