From 684a78aec863d40c08b673432ebcbe1b963714ff Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Mon, 22 Jun 2026 22:13:26 -0700 Subject: [PATCH] test: keep finalization close fixture ref alive The close fixture expects the registered object to still be reachable when the process emits exit. Keep a strong reference outside setup() so the assertion does not depend on platform-specific GC timing. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5 --- test/fixtures/process/close.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/fixtures/process/close.mjs b/test/fixtures/process/close.mjs index 2f8e94878a3061..010670f893c0c0 100644 --- a/test/fixtures/process/close.mjs +++ b/test/fixtures/process/close.mjs @@ -1,7 +1,9 @@ import { strictEqual } from 'assert' +let obj + function setup() { - const obj = { foo: 'bar' } + obj = { foo: 'bar' } process.finalization.register(obj, shutdown) } @@ -14,5 +16,6 @@ function shutdown(obj) { setup() process.on('exit', function () { + strictEqual(obj.foo, 'bar') strictEqual(shutdownCalled, true) })