DEV: Make component-test `afterEach` async aware (#10099)

DEV: Make component-test afterEach async aware (#10099)

Before this fix, if a test case was async, afterEach callback would be executed immediately, without waiting for the test to finish. :grimacing:

diff --git a/test/javascripts/helpers/component-test.js b/test/javascripts/helpers/component-test.js
index 84f382a..0330f6e 100644
--- a/test/javascripts/helpers/component-test.js
+++ b/test/javascripts/helpers/component-test.js
@@ -55,12 +55,12 @@ export default function(name, opts) {
     });
 
     andThen(() => {
-      try {
-        opts.test.call(this, assert);
-      } finally {
-        if (opts.afterEach) {
-          opts.afterEach.call(opts);
-        }
+      return opts.test.call(this, assert);
+    }).finally(() => {
+      if (opts.afterEach) {
+        andThen(() => {
+          return opts.afterEach.call(opts);
+        });
       }
     });
   });

GitHub sha: 0e2f7ecf

1 Like

This commit appears in #10099 which was approved by eviltrout. It was merged by SamSaffron.