Skip to content

Commit cea0068

Browse files
committed
Refactor safety net logic to ensure process exit after 30 seconds regardless of Node.js version
1 parent ea25015 commit cea0068

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/unit/vscode-shim-register.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,7 @@ try {
307307
// ignore
308308
}
309309

310-
// Safety net for Node < 22 which lacks --test-force-exit.
311-
// Without this, open handles (e.g. timers from imported extension code)
312-
// prevent the process from exiting after tests complete.
313-
const nodeMajor = parseInt(process.versions.node.split('.')[0], 10);
314-
if (nodeMajor < 22) {
315-
setTimeout(() => process.exit(process.exitCode ?? 0), 30_000).unref();
316-
}
310+
// Safety net: force exit after 30 s if open handles (e.g. timers from
311+
// imported extension code) prevent the process from exiting after tests.
312+
// The timer is unref()'d so it won't keep the process alive on its own.
313+
setTimeout(() => process.exit(process.exitCode ?? 0), 30_000).unref();

0 commit comments

Comments
 (0)