From e5bbbdda8a6e9a0f0373d79a1b5933239a969a4c Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 15 Jul 2026 17:12:28 +0200 Subject: [PATCH] test: keep finalization before-exit ref alive Signed-off-by: Tim Perry --- test/fixtures/process/before-exit.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/fixtures/process/before-exit.mjs b/test/fixtures/process/before-exit.mjs index 99f147e0c3e485..b8c627b0545e17 100644 --- a/test/fixtures/process/before-exit.mjs +++ b/test/fixtures/process/before-exit.mjs @@ -1,7 +1,9 @@ import { strictEqual } from 'assert' +let obj + function setup() { - const obj = { foo: 'bar' } + obj = { foo: 'bar' } process.finalization.registerBeforeExit(obj, shutdown) } @@ -27,5 +29,6 @@ function shutdown(obj, event) { setup() process.on('exit', function () { + strictEqual(obj.foo, 'bar') strictEqual(shutdownCalled, true) })