Properly close `setUpAll` and `tearDownAll` tests.
Closes #349
R=kevmoo@google.com
Review URL: https://codereview.chromium.org//1407593002 .
diff --git a/lib/src/runner/engine.dart b/lib/src/runner/engine.dart
index ed88544..8862ee3 100644
--- a/lib/src/runner/engine.dart
+++ b/lib/src/runner/engine.dart
@@ -132,6 +132,12 @@
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 @@
_passed.add(liveTest);
} else {
_liveTests.remove(liveTest);
+ _hidden.add(liveTest);
}
});
@@ -339,9 +346,12 @@
}
// 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 @@
// 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
diff --git a/pubspec.yaml b/pubspec.yaml
index a342a45..e936143 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: test
-version: 0.12.6-dev
+version: 0.12.5+1
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/test