Skip to content

Commit 85aa6ca

Browse files
cjihrigtargos
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: #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>
1 parent 7ff3551 commit 85aa6ca

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

lib/internal/test_runner/test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,7 @@ class Test extends AsyncResource {
595595

596596
const { args, ctx } = this.getRunArgs();
597597
const after = async () => {
598-
// If its a root test then check for global after hook else check for parent after hook
599-
const check = this.parent ? this.parent.hooks.after.length > 0 : this.hooks.after.length > 0;
600-
if (check) {
598+
if (this.hooks.after.length > 0) {
601599
await this.runHook('after', { __proto__: null, args, ctx });
602600
}
603601
};

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

-10
This file was deleted.

0 commit comments

Comments
 (0)