Skip to content

Commit

Permalink
Revert "test_runner: do not invoke after hook when test is empty"
Browse files Browse the repository at this point in the history
This reverts commit a53fd95.

This caused a regression because the original issue this commit
was attempting to fix is not a bug. The after() hook should
always run.

Fixes: #51997
PR-URL: #51998
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
cjihrig authored and targos committed Mar 7, 2024
1 parent 7ff3551 commit 85aa6ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
4 changes: 1 addition & 3 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,7 @@ class Test extends AsyncResource {

const { args, ctx } = this.getRunArgs();
const after = async () => {
// If its a root test then check for global after hook else check for parent after hook
const check = this.parent ? this.parent.hooks.after.length > 0 : this.hooks.after.length > 0;
if (check) {
if (this.hooks.after.length > 0) {
await this.runHook('after', { __proto__: null, args, ctx });
}
};
Expand Down
10 changes: 0 additions & 10 deletions test/parallel/test-runner-skip-after-hook.js

This file was deleted.

0 comments on commit 85aa6ca

Please sign in to comment.