Index: pkg/unittest/lib/src/test_case.dart |
diff --git a/pkg/unittest/lib/src/test_case.dart b/pkg/unittest/lib/src/test_case.dart |
index e28d21f91cbe77232ec33a8724bae1bef91adfc9..75e126c9a2b1f0ef73ebc6943e7c7170c68c5193 100644 |
--- a/pkg/unittest/lib/src/test_case.dart |
+++ b/pkg/unittest/lib/src/test_case.dart |
@@ -90,8 +90,10 @@ class TestCase { |
_result = _stackTrace = null; |
_message = ''; |
- var f = (setUp == null) ? new Future.value() : new Future(setUp); |
- return f.catchError(_errorHandler('Setup')) |
+ // Avoid calling [new Future] to avoid issue 11911. |
+ return new Future.value().then((_) { |
+ if (setUp != null) return setUp(); |
+ }).catchError(_errorHandler('Setup')) |
.then((_) { |
// Skip the test if setup failed. |
if (result != null) return new Future.value(); |