From d4667c8542befc1cebdbcfaa5e0a818fc2ca40f5 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 5f2d3dfad56cd0..bb26b5eb8b92c5 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -1420,6 +1420,9 @@ describe('tests', async () => { }); ``` +**Note:** The `after` hook is guaranteed to run, +even if tests within the suite fail. + ## `beforeEach([fn][, options])`