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. 😬
This commit is contained in:
Jarek Radosz 2020-06-24 08:03:38 +02:00 committed by GitHub
parent 843bf0df75
commit 0e2f7ecfd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,12 +55,12 @@ export default function(name, opts) {
});
andThen(() => {
try {
opts.test.call(this, assert);
} finally {
return opts.test.call(this, assert);
}).finally(() => {
if (opts.afterEach) {
opts.afterEach.call(opts);
}
andThen(() => {
return opts.afterEach.call(opts);
});
}
});
});