From 51438b7809ae100962b3beb3a3b36bd7d2ac2ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 20 Jul 2022 17:40:43 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/43836 Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig (cherry picked from commit 545ecc57360fad50c49c81b56ae25fcc99d38456) --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f6ecb9d..c67c1bd 100644 --- a/README.md +++ b/README.md @@ -343,7 +343,7 @@ internally. the test is `TODO`. **Default:** `false`. - `timeout` {number} A number of milliseconds the test will fail after. If unspecified, subtests inherit this value from their parent. - **Default:** `30_000`. + **Default:** `Infinity`. - `fn` {Function|AsyncFunction} The function under test. The first argument 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 @@ -376,6 +376,11 @@ test('top level test', async t => { }) ``` +The `timeout` option can be used to fail the test if it takes longer than +`timeout` milliseconds to complete. However, it is not a reliable mechanism for +canceling tests because a running test might block the application thread and +thus prevent the scheduled cancellation. + ## `describe([name][, options][, fn])` * `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. the test is `TODO`. **Default:** `false`. - `timeout` {number} A number of milliseconds the test will fail after. If unspecified, subtests inherit this value from their parent. - **Default:** `30_000`. + **Default:** `Infinity`. - `fn` {Function|AsyncFunction} The function under test. The first argument 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