-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: clarify after and afterEach hooks execution #51523
doc: clarify after and afterEach hooks execution #51523
Conversation
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: nodejs#50901
The `afterEach` hook is now documented to be executed after each individual test in a test suite, irrespective of whether the test passed or failed. Developers can rely on this hook for performing cleanup or resetting state after each test. Refs: nodejs#50901
Refined the language in the documentation for the `after` and `afterEach` hooks to enhance clarity. Replaced instances of "note that" with more direct and concise language for better readability. Refs: nodejs#50901
Review requested:
|
doc/api/test.md
Outdated
**Note:** The `after` hook is executed once after all the tests | ||
in a test suite have completed, regardless of whether the tests | ||
passed or failed. This hook is useful for performing cleanup tasks | ||
or actions that should occur after the entire test suite has been run. | ||
The `after` hook is guaranteed to run, even if tests within the suite fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Note:** The `after` hook is executed once after all the tests | |
in a test suite have completed, regardless of whether the tests | |
passed or failed. This hook is useful for performing cleanup tasks | |
or actions that should occur after the entire test suite has been run. | |
The `after` hook is guaranteed to run, even if tests within the suite fail. | |
**Note:** The `after` hook is guaranteed to run, even if tests within the suite fail. |
doc/api/test.md
Outdated
**Note:** The `afterEach` hook is executed after each individual test | ||
in a test suite, regardless of whether the test passed or failed. | ||
This hook is commonly used for cleaning up resources or resetting state | ||
between tests. The `afterEach` hook is guaranteed to run after every test, | ||
even if any of the tests fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Note:** The `afterEach` hook is executed after each individual test | |
in a test suite, regardless of whether the test passed or failed. | |
This hook is commonly used for cleaning up resources or resetting state | |
between tests. The `afterEach` hook is guaranteed to run after every test, | |
even if any of the tests fail. | |
**Note:** The `afterEach` hook is guaranteed to run after every test, | |
even if any of the tests fail. |
Refined the documentation for the `after` and `afterEach` hooks to enhance clarity. Removed redundant information and retained the essential details. The revised note now explicitly states that the `after` and `afterEach` hooks are guaranteed to run, even if tests within the suite fail. Refs: nodejs#50901
Hey @marco-ippolito thank you for your prompt review! 🚀 I apologize for a slight delay on my end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Adjusted line lengths in the documentation to adhere to the maximum allowed limit of 80 characters. This change resolves the linting error. Refs: nodejs#50901
Included the commit for adhering to the maximum allowed limit of 80 characters, as per linting configuration (after the change). |
Landed in 9aa211e |
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: nodejs#50901 PR-URL: nodejs#51523 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
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>
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: nodejs#50901 PR-URL: nodejs#51523 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Thanks all! |
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>
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>
Summary
This pull request addresses Issue #50901 , which highlights a documentation clarification regarding the execution of the
after
andafterEach
hooks in the test runner.Changes Made
after
Hook Documentation:after
hook is executed once after all tests in a suite, irrespective of test success or failure.afterEach
Hook Documentation:afterEach
hook is executed after each individual test, regardless of test outcomes.Additional Notes
The changes adhere to the Node.js documentation style guide.
Linting warnings related to the phrase "note that" have been addressed for improved documentation clarity.
Related Issues
Fixes: Issue #50901