Skip to content

Commit

Permalink
doc: use precise terminology in test runner
Browse files Browse the repository at this point in the history
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: #50028
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
  • Loading branch information
benjamingr committed Oct 8, 2023
1 parent 588784e commit d3a5f1f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions doc/api/test.md
Expand Up @@ -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
Expand All @@ -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);
});

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit d3a5f1f

Please sign in to comment.