Skip to content

Commit 751ffc6

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 0a81cfc commit 751ffc6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: README.md

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

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

379384
* `name` {string} The name of the suite, which is displayed when reporting test
@@ -488,7 +493,7 @@ execution of the test function. This function does not return a value.
488493
the test is `TODO`. **Default:** `false`.
489494
- `timeout` {number} A number of milliseconds the test will fail after.
490495
If unspecified, subtests inherit this value from their parent.
491-
**Default:** `30_000`.
496+
**Default:** `Infinity`.
492497
- `fn` {Function|AsyncFunction} The function under test. The first argument
493498
to this function is a [`TestContext`][] object. If the test uses callbacks,
494499
the callback function is passed as the second argument. **Default:** A no-op

0 commit comments

Comments
 (0)