Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit c713b57

Browse files
committed
Unblock test promise chain when done() is called early.
This makes it possible to end a promise_test by calling Test.done(). Previously, that would work for a single test, but would get any follow-up test stuck waiting for the global promise chain to resolve.
1 parent 7bc5fb0 commit c713b57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

testharness.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,14 @@ policies and contribution forms [3].
527527
tests.promise_tests = Promise.resolve();
528528
}
529529
tests.promise_tests = tests.promise_tests.then(function() {
530+
var earlyDonePromise = new Promise(function(resolve) {
531+
test.add_cleanup(resolve);
532+
});
530533
var promise = test.step(func, test, test);
531534
test.step(function() {
532535
assert_not_equals(promise, undefined);
533536
});
534-
return Promise.resolve(promise)
537+
return Promise.race([promise, earlyDonePromise])
535538
.then(
536539
function() {
537540
test.done();

0 commit comments

Comments
 (0)