From 0e2f7ecfd0dbd1f4d56ecb5cd895c7c5be679666 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 24 Jun 2020 08:03:38 +0200 Subject: [PATCH] DEV: Make component-test `afterEach` async aware (#10099) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this fix, if a test case was async, `afterEach` callback would be executed immediately, without waiting for the test to finish. 😬 --- test/javascripts/helpers/component-test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/javascripts/helpers/component-test.js b/test/javascripts/helpers/component-test.js index 84f382a3b45..0330f6e91a1 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); + }); } }); });