From b3157a08bf25b998eed3455da75310b10ee81aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ognjen=20Jevremovi=C4=87?= Date: Sat, 3 Feb 2024 07:24:22 +0100 Subject: [PATCH] doc: clarify execution of `after` hook on test suite completion The `after` hook now explicitly mentions that it is executed once after all the tests in a test suite have completed, regardless of whether the tests passed or failed. This ensures that cleanup tasks or actions specified in the after hook are guaranteed to run. Refs: https://github.com/nodejs/node/issues/50901 PR-URL: https://github.com/nodejs/node/pull/51523 Reviewed-By: Marco Ippolito Reviewed-By: Luigi Pinca Reviewed-By: Moshe Atlow --- doc/api/test.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index c60a07e6ad40bb..64e333f109843f 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -1435,6 +1435,9 @@ describe('tests', async () => { }); ``` +**Note:** The `after` hook is guaranteed to run, +even if tests within the suite fail. + ## `beforeEach([fn][, options])`