fix(ext/node): normalize underscored V8 flags (#34129)
## 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>