Skip to content

V3#25

Merged
SerhiyGreench merged 5 commits into
masterfrom
v3
Jul 9, 2026
Merged

V3#25
SerhiyGreench merged 5 commits into
masterfrom
v3

Conversation

@SerhiyGreench

Copy link
Copy Markdown
Contributor

No description provided.

- 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.
@SerhiyGreench SerhiyGreench merged commit bef4d51 into master Jul 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant