Skip to content

Commit c9be260

Browse files
ognjenjevremovictargos
authored andcommitted
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: #50901 PR-URL: #51523 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 1999719 commit c9be260

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/test.md

+6
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,9 @@ describe('tests', async () => {
14201420
});
14211421
```
14221422

1423+
**Note:** The `after` hook is guaranteed to run,
1424+
even if tests within the suite fail.
1425+
14231426
## `beforeEach([fn][, options])`
14241427

14251428
<!-- YAML
@@ -1473,6 +1476,9 @@ added:
14731476
This function is used to create a hook running
14741477
after each subtest of the current test.
14751478

1479+
**Note:** The `afterEach` hook is guaranteed to run after every test,
1480+
even if any of the tests fail.
1481+
14761482
```js
14771483
describe('tests', async () => {
14781484
afterEach(() => console.log('finished running a test'));

0 commit comments

Comments
 (0)