diff --git a/CHANGELOG.md b/CHANGELOG.md index ae6cda22..4a2a711e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.8.0 + +- 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', 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