Skip to content

--expose-gc should work around Node 24.7+ test-runner flag propagation regression #240

Description

@mcollina

Summary

borp --expose-gc no longer guarantees that global.gc is available inside test files on newer Node.js releases.

This appears to be due to a Node.js test runner regression introduced in Node 24.7.0, where V8-only CLI flags such as --expose-gc are not propagated to isolated child test processes.

Because borp exposes a --expose-gc option, it may make sense for borp to work around this upstream regression by normalizing the flag into NODE_OPTIONS=--expose-gc (or otherwise ensuring the child test process receives it).

Reproduction

With a test file like:

const { test } = require('node:test')

test('gc visible', () => {
  if (typeof global.gc !== 'function') {
    throw new Error('gc missing')
  }
})

On Node 24.7.0+:

borp --expose-gc -p "test/gc.js"

fails because global.gc is missing in the test file.

But this works:

NODE_OPTIONS=--expose-gc borp -p "test/gc.js"

Version check

I reproduced this split locally:

  • works: Node 22.21.1, 23.11.1, 24.0.0, 24.6.0
  • broken: Node 24.7.0, 24.8.0, 24.13.0, 25.2.1

Upstream references

Suggestion

When --expose-gc is passed to borp, consider setting/appending NODE_OPTIONS=--expose-gc before invoking the Node test runner instead of relying only on the CLI flag reaching child test processes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions