Skip to content

Commit 51438b7

Browse files
tniessenaduh95
authored andcommitted
fix(doc): improve test runner timeout docs
Add a warning to clarify that it is not a reliable mechanism for cancelling tests. Fix the default value of the timeout option. Simplify and capitalize the YAML description field. PR-URL: nodejs/node#43836 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> (cherry picked from commit 545ecc57360fad50c49c81b56ae25fcc99d38456)
1 parent cf23931 commit 51438b7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ internally.
343343
the test is `TODO`. **Default:** `false`.
344344
- `timeout` {number} A number of milliseconds the test will fail after.
345345
If unspecified, subtests inherit this value from their parent.
346-
**Default:** `30_000`.
346+
**Default:** `Infinity`.
347347
- `fn` {Function|AsyncFunction} The function under test. The first argument
348348
to this function is a [`TestContext`][] object. If the test uses callbacks,
349349
the callback function is passed as the second argument. **Default:** A no-op
@@ -376,6 +376,11 @@ test('top level test', async t => {
376376
})
377377
```
378378

379+
The `timeout` option can be used to fail the test if it takes longer than
380+
`timeout` milliseconds to complete. However, it is not a reliable mechanism for
381+
canceling tests because a running test might block the application thread and
382+
thus prevent the scheduled cancellation.
383+
379384
## `describe([name][, options][, fn])`
380385

381386
* `name` {string} The name of the suite, which is displayed when reporting test
@@ -501,7 +506,7 @@ execution of the test function. This function does not return a value.
501506
the test is `TODO`. **Default:** `false`.
502507
- `timeout` {number} A number of milliseconds the test will fail after.
503508
If unspecified, subtests inherit this value from their parent.
504-
**Default:** `30_000`.
509+
**Default:** `Infinity`.
505510
- `fn` {Function|AsyncFunction} The function under test. The first argument
506511
to this function is a [`TestContext`][] object. If the test uses callbacks,
507512
the callback function is passed as the second argument. **Default:** A no-op

0 commit comments

Comments
 (0)