Skip to content

Commit fda645a

Browse files
cjihrigrdw-msft
authored andcommitted
Revert "test_runner: do not invoke after hook when test is empty"
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: nodejs#51997 PR-URL: nodejs#51998 Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 01b6da5 commit fda645a

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

lib/internal/test_runner/test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,7 @@ class Test extends AsyncResource {
617617

618618
const { args, ctx } = this.getRunArgs();
619619
const after = async () => {
620-
// If its a root test then check for global after hook else check for parent after hook
621-
const check = this.parent ? this.parent.hooks.after.length > 0 : this.hooks.after.length > 0;
622-
if (check) {
620+
if (this.hooks.after.length > 0) {
623621
await this.runHook('after', { __proto__: null, args, ctx });
624622
}
625623
};

test/parallel/test-runner-skip-after-hook.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)