Switch coverage computation (#132)
* Switch coverage computation
* Add vm-only to tests
* Add changelog
* Add empty line
* Add debug messags
diff --git a/pkgs/firehose/.gitignore b/pkgs/firehose/.gitignore
index fa8e3e7..c948776 100644
--- a/pkgs/firehose/.gitignore
+++ b/pkgs/firehose/.gitignore
@@ -7,3 +7,5 @@
# Omit committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock
+
+coverage/
diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md
index 2587605..8f27b34 100644
--- a/pkgs/firehose/CHANGELOG.md
+++ b/pkgs/firehose/CHANGELOG.md
@@ -1,5 +1,6 @@
-## 0.3.22-wip
+## 0.3.22
- Add docs for the new `environment` input to the publish action.
+- Add coverage for web tests.
## 0.3.21
- Allow empty coverage in PR health checks.
diff --git a/pkgs/firehose/lib/src/health/coverage.dart b/pkgs/firehose/lib/src/health/coverage.dart
index c9e2f53..e82aa3e 100644
--- a/pkgs/firehose/lib/src/health/coverage.dart
+++ b/pkgs/firehose/lib/src/health/coverage.dart
@@ -88,13 +88,41 @@
['pub', 'get'],
workingDirectory: package.directory.path,
);
- var result = Process.runSync(
+ print('Get test coverage for web');
+ var resultChrome = Process.runSync(
'dart',
- ['pub', 'global', 'run', 'coverage:test_with_coverage'],
+ ['test', '-p', 'chrome', '--coverage=coverage'],
workingDirectory: package.directory.path,
);
- print(result.stdout);
- print(result.stderr);
+ print(resultChrome.stdout);
+ print(resultChrome.stderr);
+ print('Get test coverage for vm');
+ var resultVm = Process.runSync(
+ 'dart',
+ ['test', '--coverage=coverage'],
+ workingDirectory: package.directory.path,
+ );
+ print(resultVm.stdout);
+ print(resultVm.stderr);
+ var resultLcov = Process.runSync(
+ 'dart',
+ [
+ 'pub',
+ 'global',
+ 'run',
+ 'coverage:format_coverage',
+ '--lcov',
+ '--check-ignore',
+ '--report-on lib/',
+ '-i',
+ 'coverage/',
+ '-o',
+ 'coverage/lcov.info'
+ ],
+ workingDirectory: package.directory.path,
+ );
+ print(resultLcov.stdout);
+ print(resultLcov.stderr);
return parseLCOV(
path.join(package.directory.path, 'coverage/lcov.info'),
relativeTo: package.repository.baseDirectory.path,
diff --git a/pkgs/firehose/pubspec.yaml b/pkgs/firehose/pubspec.yaml
index b4f3f5d..1279d24 100644
--- a/pkgs/firehose/pubspec.yaml
+++ b/pkgs/firehose/pubspec.yaml
@@ -1,6 +1,6 @@
name: firehose
description: A tool to automate publishing of Pub packages from GitHub actions.
-version: 0.3.22-wip
+version: 0.3.22
repository: https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose
environment:
diff --git a/pkgs/firehose/test/changelog_test.dart b/pkgs/firehose/test/changelog_test.dart
index 4fe791a..44cae00 100644
--- a/pkgs/firehose/test/changelog_test.dart
+++ b/pkgs/firehose/test/changelog_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'dart:io';
diff --git a/pkgs/firehose/test/coverage_test.dart b/pkgs/firehose/test/coverage_test.dart
index ba45c26..1641c8e 100644
--- a/pkgs/firehose/test/coverage_test.dart
+++ b/pkgs/firehose/test/coverage_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'dart:io';
diff --git a/pkgs/firehose/test/license_test.dart b/pkgs/firehose/test/license_test.dart
index 7765c44..2747b03 100644
--- a/pkgs/firehose/test/license_test.dart
+++ b/pkgs/firehose/test/license_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'dart:io';
@@ -15,6 +17,7 @@
await fileWithLicense.writeAsString(license);
await fileWithoutLicense.writeAsString('');
});
+
test('Check for licenses', () async {
var filesWithoutLicenses =
await getFilesWithoutLicenses(Directory('test/'));
diff --git a/pkgs/firehose/test/pub_test.dart b/pkgs/firehose/test/pub_test.dart
index a74d875..f99a3fd 100644
--- a/pkgs/firehose/test/pub_test.dart
+++ b/pkgs/firehose/test/pub_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'package:firehose/src/pub.dart';
import 'package:test/test.dart';
diff --git a/pkgs/firehose/test/pubspec_test.dart b/pkgs/firehose/test/pubspec_test.dart
index 858972c..e35c782 100644
--- a/pkgs/firehose/test/pubspec_test.dart
+++ b/pkgs/firehose/test/pubspec_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'dart:io';
diff --git a/pkgs/firehose/test/repo_test.dart b/pkgs/firehose/test/repo_test.dart
index 5735b2a..283a4e3 100644
--- a/pkgs/firehose/test/repo_test.dart
+++ b/pkgs/firehose/test/repo_test.dart
@@ -1,6 +1,8 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@TestOn('vm')
+library;
import 'package:firehose/src/github.dart';
import 'package:firehose/src/repo.dart';