mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Refactor framework coverage tests in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing framework coverage tests Part of https://github.com/flutter/flutter/issues/145482
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'dart:io' show File;
|
|
|
|
import 'package:path/path.dart' as path;
|
|
|
|
import '../utils.dart';
|
|
|
|
Future<void> frameworkCoverageRunner() async {
|
|
final File coverageFile = File(path.join(flutterRoot, 'packages', 'flutter', 'coverage', 'lcov.info'));
|
|
if (!coverageFile.existsSync()) {
|
|
foundError(<String>[
|
|
'${red}Coverage file not found.$reset',
|
|
'Expected to find: $cyan${coverageFile.absolute.path}$reset',
|
|
'This file is normally obtained by running `${green}flutter update-packages$reset`.',
|
|
]);
|
|
return;
|
|
}
|
|
coverageFile.deleteSync();
|
|
await runFlutterTest(path.join(flutterRoot, 'packages', 'flutter'),
|
|
options: const <String>['--coverage'],
|
|
);
|
|
if (!coverageFile.existsSync()) {
|
|
foundError(<String>[
|
|
'${red}Coverage file not found.$reset',
|
|
'Expected to find: $cyan${coverageFile.absolute.path}$reset',
|
|
'This file should have been generated by the `${green}flutter test --coverage$reset` script, but was not.',
|
|
]);
|
|
return;
|
|
}
|
|
}
|