From c9be260b7d81ceb5750019c04cea1ed337e0e5f2 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 276cfc32b6f571..964fdc2732fe89 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])`