deno
bb4fe6c2 - fix(ext/node): emit deprecation warnings for legacy stream/_tls_wrap requires and module.parent (#34086)

Commit
38 days ago
fix(ext/node): emit deprecation warnings for legacy stream/_tls_wrap requires and module.parent (#34086) ## Summary - Adds the deprecation warnings Node fires from the CJS loader when user code requires the legacy `_stream_*` shim modules (DEP0193) or `_tls_wrap` (DEP0192). Previously only `_tls_common` (DEP0192) was wired up. - Adds the pending `module.parent` deprecation (DEP0144), gated on `--pending-deprecation` and emitted at most once per process, matching upstream behaviour. - Fixes the `MaxListenersExceededWarning` message produced by EventTarget so it contains the `MaxListeners is N` clause that Node's formatter and the test fixtures expect. The legacy-module warnings fire on first CJS require of each module (subsequent requires hit the existing `nativeModulePolyfill` cache, so the user-visible behaviour matches Node — exactly one warning per process per module). Internal `module?.parent?.filename` access in `_throwRequireAsyncModule` is rewritten to read `moduleParentCache` directly so the new deprecation getter isn't tripped from inside the runtime. ## Tests Manually verified each previously-failing test now passes (with `NODE_TEST_KNOWN_GLOBALS=0 NODE_SKIP_FLAG_CHECK=1` to match how the runner invokes them): - `parallel/test-warn-stream-duplex-deprecation.js` - `parallel/test-warn-stream-passthrough-deprecation.js` - `parallel/test-warn-stream-readable-deprecation.js` - `parallel/test-warn-stream-transform-deprecation.js` - `parallel/test-warn-stream-writable-deprecation.js` - `parallel/test-warn-tls-wrap-deprecation.js` - `parallel/test-module-parent-deprecation.js` (with `--pending-deprecation`) - `parallel/test-module-parent-setter-deprecation.js` (with `--pending-deprecation`) The existing `parallel/test-warn-tls-common-deprecation.js`, `parallel/test-process-emitwarning.js`, `parallel/test-process-warning.js`, and `parallel/test-common-expect-warning.js` still pass (no regression). The newly-passing tests are added to `tests/node_compat/config.jsonc` so they run in CI. ## Background The orchid issue framed this as "process.emitWarning not firing callbacks — 89 tests failing", suggesting a single fix to the `emitWarning` dispatch path. After investigation, `emitWarning` itself works correctly; the 89 `mustCall`/`expectWarning` failures actually span a wide range of unrelated subsystems (`diagnostics_channel`, `fs.WriteStream`, `PerformanceObserver`, worker message ports, REPL history, signal handlers, etc.) and need separate fixes. This PR addresses the subset that **was** a deprecation-warning gap — eight tests in total — so they stop being conflated with the broader mustCall coverage problem. Closes denoland/orchid#92 --------- Co-authored-by: divybot <divybot@users.noreply.github.com>
Author
Parents
Loading