mirror of https://github.com/tc39/test262.git
Call $DONE function exactly once per test
Also make a note in CONTRIBUTING.md that `$DONE` shouldn't be called multiple times.
This commit is contained in:
parent
64b6b844eb
commit
d8c20b423b
|
@ -298,7 +298,7 @@ Consumers that violate the spec by throwing exceptions for parsing errors at run
|
|||
|
||||
## Writing Asynchronous Tests
|
||||
|
||||
An asynchronous test is any test that include the `async` frontmatter flag. When executing such tests, the runner expects that the global `$DONE()` function will be called to signal test completion.
|
||||
An asynchronous test is any test that include the `async` frontmatter flag. When executing such tests, the runner expects that the global `$DONE()` function will be called **exactly once** to signal test completion.
|
||||
|
||||
* If the argument to `$DONE` is omitted, is `undefined`, or is any other falsy value, the test is considered to have passed.
|
||||
|
||||
|
|
|
@ -43,5 +43,4 @@ Promise.allSettled([thenable])
|
|||
assert.sameValue(settleds.length, 1);
|
||||
assert.sameValue(settleds[0].status, 'rejected');
|
||||
assert.sameValue(settleds[0].reason, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -49,5 +49,4 @@ Promise.allSettled([fulfiller, rejector])
|
|||
assert.sameValue(settleds[0].value, 42);
|
||||
assert.sameValue(settleds[1].status, 'fulfilled');
|
||||
assert.sameValue(settleds[1].value, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -40,5 +40,4 @@ Promise.allSettled([fulfiller, lateRejector])
|
|||
assert.sameValue(settleds[0].value, 42);
|
||||
assert.sameValue(settleds[1].status, 'fulfilled');
|
||||
assert.sameValue(settleds[1].value, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -27,5 +27,4 @@ var thenable = {
|
|||
Promise.allSettled([thenable])
|
||||
.then((settleds) => {
|
||||
checkSettledPromises(settleds, [{ status: 'rejected', reason: simulation }]);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
}).then($DONE, $DONE);
|
||||
|
|
Loading…
Reference in New Issue