Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c9be260

Browse filesBrowse 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
Copy full SHA for c9be260

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/test.md‎

Copy file name to clipboardExpand all lines: doc/api/test.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.