Consider all json for format (#290)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9af50c1..b97c52b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,6 @@
-## 0.13.6-dev
+## 0.13.6 - 2020-02-10
+
+* Now consider all `.json` files for the `format_coverage` command.
## 0.13.5 - 2020-01-30
diff --git a/bin/format_coverage.dart b/bin/format_coverage.dart
index 295f861..0b15899 100644
--- a/bin/format_coverage.dart
+++ b/bin/format_coverage.dart
@@ -221,12 +221,11 @@
/// are contained by it if it is a directory, or a [List] containing the file if
/// it is a file.
List<File> filesToProcess(String absPath) {
- final filePattern = RegExp(r'^dart-cov-\d+-\d+.json$');
if (FileSystemEntity.isDirectorySync(absPath)) {
return Directory(absPath)
.listSync(recursive: true)
.whereType<File>()
- .where((e) => filePattern.hasMatch(p.basename(e.path)))
+ .where((e) => e.path.endsWith('.json'))
.toList();
}
return <File>[File(absPath)];
diff --git a/pubspec.yaml b/pubspec.yaml
index 95ef3b9..6757599 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: coverage
-version: 0.13.6-dev
+version: 0.13.6
description: Coverage data manipulation and formatting
homepage: https://github.com/dart-lang/coverage
diff --git a/test/format_coverage_test.dart b/test/format_coverage_test.dart
new file mode 100644
index 0000000..f791df3
--- /dev/null
+++ b/test/format_coverage_test.dart
@@ -0,0 +1,33 @@
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
+
+import '../bin/format_coverage.dart';
+
+void main() {
+ Directory testDir;
+ setUp(() {
+ testDir = Directory.systemTemp.createTempSync('coverage_test_temp');
+ });
+
+ tearDown(() async {
+ if (testDir.existsSync()) testDir.deleteSync(recursive: true);
+ });
+
+ test('considers all json files', () async {
+ final fileA = File(p.join(testDir.path, 'coverage_a.json'));
+ fileA.createSync();
+ final fileB = File(p.join(testDir.path, 'coverage_b.json'));
+ fileB.createSync();
+ final fileC = File(p.join(testDir.path, 'not_coverage.foo'));
+ fileC.createSync();
+
+ final files = filesToProcess(testDir.path);
+ expect(files.length, equals(2));
+ expect(
+ files.map((f) => f.path),
+ containsAll(
+ [endsWith('coverage_a.json'), endsWith('coverage_b.json')]));
+ });
+}
diff --git a/test/test_all.dart b/test/test_all.dart
index 9c84df5..0b9e880 100644
--- a/test/test_all.dart
+++ b/test/test_all.dart
@@ -7,6 +7,7 @@
import 'chrome_test.dart' as chrome;
import 'collect_coverage_api_test.dart' as collect_coverage_api;
import 'collect_coverage_test.dart' as collect_coverage;
+import 'format_coverage_test.dart' as format_coverage;
import 'lcov_test.dart' as lcov;
import 'resolver_test.dart' as resolver;
import 'run_and_collect_test.dart' as run_and_collect;
@@ -15,6 +16,7 @@
void main() {
group('collect_coverage_api', collect_coverage_api.main);
group('collect_coverage', collect_coverage.main);
+ group('format_coverage', format_coverage.main);
group('lcov', lcov.main);
group('resolver', resolver.main);
group('run_and_collect', run_and_collect.main);