Skip to content
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

test runner: dors the after hook run After failure ? #50901

Closed
jehon opened this issue Nov 24, 2023 · 3 comments
Closed

test runner: dors the after hook run After failure ? #50901

jehon opened this issue Nov 24, 2023 · 3 comments
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. test_runner Issues and PRs related to the test runner subsystem.

Comments

@jehon
Copy link

jehon commented Nov 24, 2023

Affected URL(s)

https://nodejs.org/api/test.html#afterfn-options

Description of the problem

In the document,it is unclear wether the after hook is run when the test did failed.
Same for the afterEach hook.

@jehon jehon added the doc Issues and PRs related to the documentations. label Nov 24, 2023
@marco-ippolito
Copy link
Member

Hooks are executed even if tests fail. PRs to documentation are welcomed

@marco-ippolito marco-ippolito added test_runner Issues and PRs related to the test runner subsystem. good first issue Issues that are suitable for first-time contributors. labels Jan 18, 2024
ognjenjevremovic added a commit to ognjenjevremovic/node that referenced this issue Jan 19, 2024
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
ognjenjevremovic added a commit to ognjenjevremovic/node that referenced this issue Jan 19, 2024
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
ognjenjevremovic added a commit to ognjenjevremovic/node that referenced this issue Jan 19, 2024
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
@ognjenjevremovic
Copy link
Contributor

Hello everyone 👋

I'm excited to share that I've addressed the concerns raised in this issue regarding the documentation for the after and afterEach hooks. I've submitted a pull request (#51523) that refines the documentation to clarify the execution behavior of these hooks.

As a first-time contributor to the Node.js (runtime), I'm thrilled to be a part of this amazing community. I've ensured that the changes adhere to the project's documentation style guide and have addressed linting warnings for improved clarity.

Feel free to review the pull request, provide feedback, or let me know if there's anything else I can do to enhance the contribution. I'm looking forward to being a more active part of the Node.js community! 🙂

ognjenjevremovic added a commit to ognjenjevremovic/node that referenced this issue Jan 20, 2024
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
ognjenjevremovic added a commit to ognjenjevremovic/node that referenced this issue Jan 20, 2024
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
nodejs-github-bot pushed a commit that referenced this issue Feb 3, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
rdw-msft pushed a commit to rdw-msft/node that referenced this issue Feb 9, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
targos pushed a commit that referenced this issue Feb 15, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
marco-ippolito pushed a commit to marco-ippolito/node that referenced this issue Feb 19, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
@MoLow MoLow closed this as completed Mar 15, 2024
@MoLow
Copy link
Member

MoLow commented Mar 15, 2024

Fixed by #51523

richardlau pushed a commit that referenced this issue Mar 25, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
richardlau pushed a commit that referenced this issue Mar 25, 2024
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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants