Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: lib/src/runner/engine.dart

Issue 1407593002: Properly close `setUpAll` and `tearDownAll` tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/engine.dart
diff --git a/lib/src/runner/engine.dart b/lib/src/runner/engine.dart
index ed88544469073593e889b37943542cd38def2047..8862ee312f237e2a86388a3ae98c63b0f21fa633 100644
--- a/lib/src/runner/engine.dart
+++ b/lib/src/runner/engine.dart
@@ -132,6 +132,12 @@ class Engine {
List<LiveTest> get active => new UnmodifiableListView(_active);
final _active = new QueueList<LiveTest>();
+ /// The set of tests that have completed successfully but shouldn't be
+ /// displayed by the reporter.
+ ///
+ /// This includes load tests, `setUpAll`, and `tearDownAll`.
+ final _hidden = new Set<LiveTest>();
+
/// The tests from [LoadSuite]s that are still running, in the order they
/// began running.
///
@@ -294,6 +300,7 @@ class Engine {
_passed.add(liveTest);
} else {
_liveTests.remove(liveTest);
+ _hidden.add(liveTest);
}
});
@@ -339,9 +346,12 @@ class Engine {
}
// Surface the load test if it fails so that the user can see the failure.
- if (state.result == Result.success) return;
- _failed.add(liveTest);
- _liveTests.add(liveTest);
+ if (state.result == Result.success) {
+ _hidden.add(liveTest);
+ } else {
+ _failed.add(liveTest);
+ _liveTests.add(liveTest);
+ }
});
// Run the test immediately. We don't want loading to be blocked on suites
@@ -369,7 +379,9 @@ class Engine {
// Close the running tests first so that we're sure to wait for them to
// finish before we close their suites and cause them to become unloaded.
- var allLiveTests = liveTests.toSet()..addAll(_activeLoadTests);
+ var allLiveTests = liveTests.toSet()
+ ..addAll(_activeLoadTests)
+ ..addAll(_hidden);
var futures = allLiveTests.map((liveTest) => liveTest.close()).toList();
// Closing the load pool will close the test suites as soon as their tests
« no previous file with comments | « no previous file | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698