Skip to content

Commit 89df046

Browse files
authored
test: keep finalization before-exit ref alive
Signed-off-by: Tim Perry <pimterry@gmail.com> PR-URL: #64521 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 050fc39 commit 89df046

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

test/fixtures/process/before-exit.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { strictEqual } from 'assert'
22

3+
let obj
4+
35
function setup() {
4-
const obj = { foo: 'bar' }
6+
obj = { foo: 'bar' }
57
process.finalization.registerBeforeExit(obj, shutdown)
68
}
79

@@ -27,5 +29,6 @@ function shutdown(obj, event) {
2729
setup()
2830

2931
process.on('exit', function () {
32+
strictEqual(obj.foo, 'bar')
3033
strictEqual(shutdownCalled, true)
3134
})

0 commit comments

Comments
 (0)