Repository navigation
fix(tests/node_compat): normalize underscored V8 flags - #34129
Merged
Merged
Conversation
The Node test suite uses `--expose_gc` and `--allow_natives_syntax` (underscored) interchangeably with `--expose-gc` / `--allow-natives-syntax` (hyphenated). V8 itself accepts both spellings, but the node_compat runner's flag extractor only matched the hyphenated forms, so tests written with underscores were launched without `--v8-flags=--expose-gc`. Their first call to `globalThis.gc()` then failed with `TypeError: globalThis.gc is not a function`. Normalize underscores to hyphens before matching so both spellings produce the same `--v8-flags=...` entry. Closes denoland/orchid#110 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
littledivy
approved these changes
May 16, 2026
littledivy
reviewed
May 16, 2026
littledivy
left a comment
Member
There was a problem hiding this comment.
Enable the newly passing tests
Add the four tests fixed by the underscored-flag normalization to the default config.jsonc set so they run on CI (not just `--report` mode). - parallel/test-async-hooks-destroy-on-gc.js - parallel/test-async-hooks-disable-gc-tracking.js - parallel/test-async-hooks-prevent-double-destroy.js - parallel/test-http-parser-bad-ref.js Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
littledivy
pushed a commit
to crowlKats/deno
that referenced
this pull request
Jun 10, 2026
## Summary
The Node.js test suite writes V8 flags in both `--expose-gc`
(hyphenated) and `--expose_gc` (underscored) form interchangeably — V8
normalizes them internally. Deno's node_compat runner extracts `//
Flags:` lines from each test and forwards a curated subset as
`--v8-flags=...`, but the extractor only matched the hyphenated
spellings. Tests written with the underscored form were launched without
the flag, so their first call to `globalThis.gc()` failed with:
```
TypeError: globalThis.gc is not a function
globalThis.gc();
^
```
The fix normalizes `_` → `-` after the leading `--` before matching, so
a single arm handles both spellings.
Five tests previously failed solely because of this. With the fix:
| Test | Before | After |
|---|---|---|
| `parallel/test-async-hooks-destroy-on-gc.js` | fail (`globalThis.gc is
not a function`) | pass |
| `parallel/test-async-hooks-disable-gc-tracking.js` | fail (same) |
pass |
| `parallel/test-async-hooks-prevent-double-destroy.js` | fail (same) |
pass |
| `parallel/test-http-parser-bad-ref.js` | fail (same) | pass |
| `parallel/test-abortsignal-drop-settled-signals.mjs` | fail (same) |
now fails on a separate, unrelated AbortSignal-internals issue |
The same normalization fixes `--allow_natives_syntax` (used by
`parallel/test-http-same-map.js`), which previously also slipped
through.
The runtime side already works: `deno run --v8-flags=--expose-gc`
exposes `globalThis.gc` correctly. No runtime changes needed — fix is
purely in `tests/node_compat/mod.rs::parse_flags`.
Closes denoland/orchid#110
## Test plan
- [x] `cargo test --test node_compat -- test-async-hooks-destroy-on-gc`
passes
- [x] `cargo test --test node_compat --
test-async-hooks-disable-gc-tracking` passes
- [x] `cargo test --test node_compat --
test-async-hooks-prevent-double-destroy` passes
- [x] `cargo test --test node_compat -- test-http-parser-bad-ref` passes
- [x] `cargo test --test node_compat -- test-weakref` (uses hyphenated
`--expose-gc`) still passes — no regression
- [x] `cargo clippy --tests -p node_compat_tests` clean
---------
Co-authored-by: divybot <divybot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Node.js test suite writes V8 flags in both
--expose-gc(hyphenated) and--expose_gc(underscored) form interchangeably — V8 normalizes them internally. Deno's node_compat runner extracts// Flags:lines from each test and forwards a curated subset as--v8-flags=..., but the extractor only matched the hyphenated spellings. Tests written with the underscored form were launched without the flag, so their first call toglobalThis.gc()failed with:The fix normalizes
_→-after the leading--before matching, so a single arm handles both spellings.Five tests previously failed solely because of this. With the fix:
parallel/test-async-hooks-destroy-on-gc.jsglobalThis.gc is not a function)parallel/test-async-hooks-disable-gc-tracking.jsparallel/test-async-hooks-prevent-double-destroy.jsparallel/test-http-parser-bad-ref.jsparallel/test-abortsignal-drop-settled-signals.mjsThe same normalization fixes
--allow_natives_syntax(used byparallel/test-http-same-map.js), which previously also slipped through.The runtime side already works:
deno run --v8-flags=--expose-gcexposesglobalThis.gccorrectly. No runtime changes needed — fix is purely intests/node_compat/mod.rs::parse_flags.Closes denoland/orchid#110
Test plan
cargo test --test node_compat -- test-async-hooks-destroy-on-gcpassescargo test --test node_compat -- test-async-hooks-disable-gc-trackingpassescargo test --test node_compat -- test-async-hooks-prevent-double-destroypassescargo test --test node_compat -- test-http-parser-bad-refpassescargo test --test node_compat -- test-weakref(uses hyphenated--expose-gc) still passes — no regressioncargo clippy --tests -p node_compat_testsclean🤖 Generated with Claude Code