Use $DONE instead of $ERROR to avoid unhandled rejections

This commit is contained in:
Alexey Shvayka 2020-07-07 16:03:11 +03:00 committed by Leo Balter
parent 739c4cd78d
commit c472aeea4b
4 changed files with 10 additions and 12 deletions

View File

@ -36,5 +36,4 @@ yes.then(function(x) {
}).then(function() { }).then(function() {
assert.sameValue(sequence.length, 5); assert.sameValue(sequence.length, 5);
checkSequence(sequence, "All expected callbacks called in correct order"); checkSequence(sequence, "All expected callbacks called in correct order");
$DONE(); }).then($DONE, $DONE);
}).catch($ERROR);

View File

@ -20,6 +20,5 @@ class FooPromise extends Promise {
new FooPromise(r => r()) new FooPromise(r => r())
.finally(() => {}) .finally(() => {})
.then(() => { .then(() => {
assert.sameValue(count, 6, "6 new promises were created"); assert.sameValue(count, 7, "7 new promises were created");
$DONE(); }).then($DONE, $DONE);
}, $ERROR);

View File

@ -16,7 +16,8 @@ class FooPromise extends Promise {
} }
} }
FooPromise.reject().finally(() => {}).then($ERROR).catch(() => { FooPromise.reject().finally(() => {}).then(value => {
assert.sameValue(7, count); throw new Test262Error("Expected Promise to be rejected, got: resolved with " + value);
$DONE(); }, () => {
}); assert.sameValue(count, 7);
}).then($DONE, $DONE);

View File

@ -17,6 +17,5 @@ class FooPromise extends Promise {
} }
FooPromise.resolve().finally(() => {}).then(() => { FooPromise.resolve().finally(() => {}).then(() => {
assert.sameValue(6, count); assert.sameValue(count, 7);
$DONE(); }).then($DONE, $DONE);
}, $ERROR);