doc: use precise terminology in test runner

We currently use `resolve` which is incorrect from a technical point of
view in several places in the test runner docs.

For anyone wondering "resolves" means the promise's fate is known by
either settling (becoming fulfilled or rejected) or because it's
assimilating the status of another promise (that may be unfulfilled).

PR-URL: https://github.com/nodejs/node/pull/50028
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Benjamin Gruenbaum 2023-10-08 13:05:04 +03:00 committed by GitHub
parent 588784ea30
commit d3a5f1fb5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ processed in one of three ways:
1. A synchronous function that is considered failing if it throws an exception,
and is considered passing otherwise.
2. A function that returns a `Promise` that is considered failing if the
`Promise` rejects, and is considered passing if the `Promise` resolves.
`Promise` rejects, and is considered passing if the `Promise` fulfills.
3. A function that receives a callback function. If the callback receives any
truthy value as its first argument, the test is considered failing. If a
falsy value is passed as the first argument to the callback, the test is
@ -67,7 +67,7 @@ test('synchronous failing test', (t) => {
test('asynchronous passing test', async (t) => {
// This test passes because the Promise returned by the async
// function is not rejected.
// function is settled and not rejected.
assert.strictEqual(1, 1);
});
@ -984,7 +984,7 @@ changes:
to this function is a [`TestContext`][] object. If the test uses callbacks,
the callback function is passed as the second argument. **Default:** A no-op
function.
* Returns: {Promise} Resolved with `undefined` once
* Returns: {Promise} Fulfilled with `undefined` once
the test completes, or immediately if the test runs within [`describe()`][].
The `test()` function is the value imported from the `test` module. Each
@ -994,8 +994,8 @@ The `TestContext` object passed to the `fn` argument can be used to perform
actions related to the current test. Examples include skipping the test, adding
additional diagnostic information, or creating subtests.
`test()` returns a `Promise` that resolves once the test completes.
if `test()` is called within a `describe()` block, it resolve immediately.
`test()` returns a `Promise` that fulfills once the test completes.
if `test()` is called within a `describe()` block, it fulfills immediately.
The return value can usually be discarded for top level tests.
However, the return value from subtests should be used to prevent the parent
test from finishing first and cancelling the subtest
@ -2497,7 +2497,7 @@ changes:
to this function is a [`TestContext`][] object. If the test uses callbacks,
the callback function is passed as the second argument. **Default:** A no-op
function.
* Returns: {Promise} Resolved with `undefined` once the test completes.
* Returns: {Promise} Fulfilled with `undefined` once the test completes.
This function is used to create subtests under the current test. This function
behaves in the same fashion as the top level [`test()`][] function.