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: nodejs#51997
  • Loading branch information
cjihrig committed Mar 7, 2024
1 parent 2246cd9 commit c39a545
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 @@ -617,9 +617,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 c39a545

Please sign in to comment.