V3#25
Merged
Merged
Conversation
- package.json: type=module, exports map, engines node>=22.12 - explicit .js extensions on all relative imports - IMQ.create(): static adapter registry replaces synchronous dynamic require (ESM has no sync dynamic loading) - UDPClusterManager: import.meta.dirname replaces __dirname - tests: mocks preloaded via --import (ESM links the whole graph before evaluation, so in-spec mock registration is too late); ioredis mock exposes a named Redis export; util.inspect patches published to ESM bindings via syncBuiltinESMExports(); reRequire reimplemented with query-busted dynamic import BREAKING CHANGE: package is ESM-only; CJS consumers require Node >=22.12 (require(esm)) and TypeScript >=5.8 to type-check
- target/lib es2024 (Node >=22.12 floor fully implements it) - skipLibCheck guards against third-party d.ts breakage - verbatimModuleSyntax with import type annotations throughout (ESM-only option, hence esm branch only)
The Node >=24 branch of moduleMockOptions() passed mock exports through
the undocumented `exports` option, whose behavior changed between 24.x
releases (module mocking is experimental) — newer runtimes on CI stopped
applying the named exports, so ESM sources importing { Redis } from the
mocked ioredis received undefined (TypeError: Redis is not a constructor).
The documented defaultExport/namedExports pair works consistently on 22.x
and 24.x (deprecation warning only) and is now used unconditionally. Also
applies oxfmt formatting the esm migration commits missed.
The 24.17/24.18 module-loader changes broke cache:true mock modules:
the mocked specifier exposes its export names with values never bound,
so ESM sources importing { Redis } from the mocked ioredis received
undefined (TypeError: Redis is not a constructor) — reproduced 1:1 in
docker node:24 (24.18.0) while node 24.16 still worked.
cache:false restores correct binding on every supported version
(verified on 22.23.1, 24.16.0 and 24.18.0 — 249/249 each). Instance
caching was not load-bearing for these mocks: all shared state lives
on the exported references themselves (RedisClientMock statics), so
each re-evaluation serves the same objects.
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.
No description provided.