From 570952d4f305bf0db41d532cecd664483cc0ad08 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Wed, 24 Jun 2026 23:22:46 -0700 Subject: [PATCH] test: keep finalization close fixture ref alive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 PR-URL: https://github.com/nodejs/node/pull/64085 Refs: https://github.com/nodejs/reliability/issues?q=%22test-process-finalization%22 Reviewed-By: Luigi Pinca Reviewed-By: Gürgün Dayıoğlu Reviewed-By: Stefan Stojanovic --- 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 2f8e94878a3..010670f893c 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) })