Remove cancel from Reporter interface (#1323)
This method is never called from outside any reporter so it is
unnecessary to require it. The cancel method on `ExpandedReporter` was
never called before, add a call in `_onDone` to match the other
reporters.
diff --git a/pkgs/test_core/lib/src/runner/reporter.dart b/pkgs/test_core/lib/src/runner/reporter.dart
index ddb938b..7caa944 100644
--- a/pkgs/test_core/lib/src/runner/reporter.dart
+++ b/pkgs/test_core/lib/src/runner/reporter.dart
@@ -19,7 +19,4 @@
/// Subclasses should ensure that this does nothing if the reporter isn't
/// paused.
void resume();
-
- /// Cancels the reporter's output.
- void cancel();
}
diff --git a/pkgs/test_core/lib/src/runner/reporter/compact.dart b/pkgs/test_core/lib/src/runner/reporter/compact.dart
index 1b0e027..fd43a49 100644
--- a/pkgs/test_core/lib/src/runner/reporter/compact.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/compact.dart
@@ -145,8 +145,7 @@
}
}
- @override
- void cancel() {
+ void _cancel() {
for (var subscription in _subscriptions) {
subscription.cancel();
}
@@ -239,7 +238,7 @@
/// [success] will be `true` if all tests passed, `false` if some tests
/// failed, and `null` if the engine was closed prematurely.
void _onDone(bool? success) {
- cancel();
+ _cancel();
_stopwatch.stop();
// A null success value indicates that the engine was closed before the
diff --git a/pkgs/test_core/lib/src/runner/reporter/expanded.dart b/pkgs/test_core/lib/src/runner/reporter/expanded.dart
index 36ce474..f62f233 100644
--- a/pkgs/test_core/lib/src/runner/reporter/expanded.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/expanded.dart
@@ -141,8 +141,7 @@
}
}
- @override
- void cancel() {
+ void _cancel() {
for (var subscription in _subscriptions) {
subscription.cancel();
}
@@ -220,6 +219,7 @@
/// [success] will be `true` if all tests passed, `false` if some tests
/// failed, and `null` if the engine was closed prematurely.
void _onDone(bool? success) {
+ _cancel();
// A null success value indicates that the engine was closed before the
// tests finished running, probably because of a signal from the user, in
// which case we shouldn't print summary information.
diff --git a/pkgs/test_core/lib/src/runner/reporter/json.dart b/pkgs/test_core/lib/src/runner/reporter/json.dart
index d4f61bd..b1346fc 100644
--- a/pkgs/test_core/lib/src/runner/reporter/json.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/json.dart
@@ -106,8 +106,7 @@
}
}
- @override
- void cancel() {
+ void _cancel() {
for (var subscription in _subscriptions) {
subscription.cancel();
}
@@ -276,7 +275,7 @@
/// [success] will be `true` if all tests passed, `false` if some tests
/// failed, and `null` if the engine was closed prematurely.
void _onDone(bool? success) {
- cancel();
+ _cancel();
_stopwatch.stop();
_emit('done', {'success': success});
diff --git a/pkgs/test_core/lib/src/runner/reporter/multiplex.dart b/pkgs/test_core/lib/src/runner/reporter/multiplex.dart
index e13c1b4..59a9841 100644
--- a/pkgs/test_core/lib/src/runner/reporter/multiplex.dart
+++ b/pkgs/test_core/lib/src/runner/reporter/multiplex.dart
@@ -10,13 +10,6 @@
MultiplexReporter(this.delegates);
@override
- void cancel() {
- for (var d in delegates) {
- d.cancel();
- }
- }
-
- @override
void pause() {
for (var d in delegates) {
d.pause();