Skip to content

Commit 62f7408

Browse files
authored
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.
1 parent e37a93b commit 62f7408

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

pkgs/test_core/lib/src/runner/reporter.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@ abstract class Reporter {
1919
/// Subclasses should ensure that this does nothing if the reporter isn't
2020
/// paused.
2121
void resume();
22-
23-
/// Cancels the reporter's output.
24-
void cancel();
2522
}

pkgs/test_core/lib/src/runner/reporter/compact.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ class CompactReporter implements Reporter {
145145
}
146146
}
147147

148-
@override
149-
void cancel() {
148+
void _cancel() {
150149
for (var subscription in _subscriptions) {
151150
subscription.cancel();
152151
}
@@ -239,7 +238,7 @@ class CompactReporter implements Reporter {
239238
/// [success] will be `true` if all tests passed, `false` if some tests
240239
/// failed, and `null` if the engine was closed prematurely.
241240
void _onDone(bool? success) {
242-
cancel();
241+
_cancel();
243242
_stopwatch.stop();
244243

245244
// A null success value indicates that the engine was closed before the

pkgs/test_core/lib/src/runner/reporter/expanded.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ class ExpandedReporter implements Reporter {
141141
}
142142
}
143143

144-
@override
145-
void cancel() {
144+
void _cancel() {
146145
for (var subscription in _subscriptions) {
147146
subscription.cancel();
148147
}
@@ -220,6 +219,7 @@ class ExpandedReporter implements Reporter {
220219
/// [success] will be `true` if all tests passed, `false` if some tests
221220
/// failed, and `null` if the engine was closed prematurely.
222221
void _onDone(bool? success) {
222+
_cancel();
223223
// A null success value indicates that the engine was closed before the
224224
// tests finished running, probably because of a signal from the user, in
225225
// which case we shouldn't print summary information.

pkgs/test_core/lib/src/runner/reporter/json.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class JsonReporter implements Reporter {
106106
}
107107
}
108108

109-
@override
110-
void cancel() {
109+
void _cancel() {
111110
for (var subscription in _subscriptions) {
112111
subscription.cancel();
113112
}
@@ -276,7 +275,7 @@ class JsonReporter implements Reporter {
276275
/// [success] will be `true` if all tests passed, `false` if some tests
277276
/// failed, and `null` if the engine was closed prematurely.
278277
void _onDone(bool? success) {
279-
cancel();
278+
_cancel();
280279
_stopwatch.stop();
281280

282281
_emit('done', {'success': success});

pkgs/test_core/lib/src/runner/reporter/multiplex.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ class MultiplexReporter implements Reporter {
99

1010
MultiplexReporter(this.delegates);
1111

12-
@override
13-
void cancel() {
14-
for (var d in delegates) {
15-
d.cancel();
16-
}
17-
}
18-
1912
@override
2013
void pause() {
2114
for (var d in delegates) {

0 commit comments

Comments
 (0)