Index: lib/src/backend/group.dart |
diff --git a/lib/src/backend/group.dart b/lib/src/backend/group.dart |
index 47e06e3aa1eabb6ca6eeb0336d971242a4e730b8..806c3bb7a5d4aa3c3faac94886c60b7b7f5d1e67 100644 |
--- a/lib/src/backend/group.dart |
+++ b/lib/src/backend/group.dart |
@@ -74,14 +74,14 @@ class Group { |
/// If no set-up functions are declared, this returns a [Future] that |
/// completes immediately. |
Future runTearDowns() { |
- // TODO(nweiz): Use async/await here once issue 23497 has been fixed in two |
- // stable versions. |
- if (parent == null) { |
- return Future.forEach(tearDowns.reversed, _errorsDontStopTest); |
- } |
- |
- return Future.forEach(tearDowns.reversed, _errorsDontStopTest) |
- .then((_) => parent.runTearDowns()); |
+ return Invoker.current.unclosable(() { |
+ var tearDowns = []; |
+ for (var group = this; group != null; group = group.parent) { |
+ tearDowns.addAll(group.tearDowns.reversed); |
+ } |
+ |
+ return Future.forEach(tearDowns, _errorsDontStopTest); |
+ }); |
} |
/// Runs [body] with special error-handling behavior. |