Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! test_runner: run before hook immediately if test started
fixup
  • Loading branch information
MoLow committed Mar 7, 2024
commit 9b493bff25814320f796517766e1ee2c0978d7f8
3 changes: 2 additions & 1 deletion lib/internal/test_runner/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ function setup(root) {
createProcessEventHandler('unhandledRejection', root);
const coverage = configureCoverage(root, globalOptions);
const exitHandler = async () => {
if (root.subtests.length === 0) {
if (root.subtests.length === 0 && (root.hooks.before.length > 0 || root.hooks.after.length > 0)) {
// Run global before/after hooks in case there are no tests
await root.run();
}
root.postRun(new ERR_TEST_FAILURE(
Expand Down