diff --git a/pkgs/firehose/.gitignore b/pkgs/firehose/.gitignore index fa8e3e7b..c9487764 100644 --- a/pkgs/firehose/.gitignore +++ b/pkgs/firehose/.gitignore @@ -7,3 +7,5 @@ build/ # 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 2587605c..8f27b343 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 c9e2f537..e82aa3e1 100644 --- a/pkgs/firehose/lib/src/health/coverage.dart +++ b/pkgs/firehose/lib/src/health/coverage.dart @@ -88,13 +88,41 @@ Get coverage for ${package.name} by running coverage in ${package.directory.path ['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 b4f3f5db..1279d246 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 4fe791ad..44cae005 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 ba45c260..1641c8e4 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 7765c444..2747b038 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 @@ void main() { 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 a74d8753..f99a3fd3 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 858972c2..e35c7826 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 5735b2a0..283a4e3b 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';