Skip to content

build!: migrate the test suite to node:test and require Node.js >= 22.12.0 - #309

Merged
alexander-akait merged 2 commits into
mainfrom
build/node-test-runner
Sep 7, 2026
Merged

build!: migrate the test suite to node:test and require Node.js >= 22.12.0#309
alexander-akait merged 2 commits into
mainfrom
build/node-test-runner

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

The suite runs on the test runner Node ships, so jest, @jest/globals and jest.config.js go away. describe/it and the lifecycle hooks come from node:test, assertions from node:assert/strict, and coverage from --experimental-test-coverage written as lcov for codecov. Node.js 20 is end-of-life, so engines.node moves to the oldest maintained LTS, >= 22.12.0.

Nothing in src/ changed. Four things in the diff are worth a reviewer's attention:

  • assert.rejects(promise, "text") reads the string as the assertion's own message, not as a matcher. Every .rejects.toThrow("…") and .toThrow("…") became a regex instead, so those 11 assertions still check what they used to rather than passing on any rejection at all.
  • The suite ran through babel under jest, and now runs as written. Relative imports needed explicit extensions, and fs-extra's named exports do not survive native ESM interop — copySync/removeSync are node:fs's cpSync/rmSync, so fs-extra and @types/fs-extra are gone too.
  • eslint-config-webpack scopes its test-file rule relaxations behind having jest as a dependency, so removing jest turned id-length, jsdoc/require-jsdoc and the n/no-unsupported-features/* rules back on for test/**. eslint.config.mjs now carries that same set itself.
  • utils mocked node:fs through jest.unstable_mockModule. It stats real fixture paths now instead, which is what the mock was standing in for.

What kind of change does this PR introduce?

build (breaking).

Did you add tests for your changes?

No new tests — the suite is the subject of the change. All 60 files are ported: 124 passing and the 2 ESLint 10 eslintrc suites skipped, the same counts as on main, with coverage at 99.33% of lines.

Does this PR introduce a breaking change?

Yes. Node.js 20 is no longer supported; the minimum is >= 22.12.0. Node 20 reached end-of-life in April 2026, and the CI matrix drops to 22.x and 24.x.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

The README's support note names the Node.js requirement. A changeset is included marking this a major.

Use of AI

Written with Claude Code, driven interactively. I asked for the migration and the version bump; Claude did the conversion, found the assert.rejects message-vs-matcher trap and the jest-gated lint config, and reported both. I reviewed the result.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy


Generated by Claude Code

alexander-akait and others added 2 commits September 7, 2026 13:23
….12.0

The suite runs on the runner Node ships. Assertions become `node:assert`,
`describe`/`it` and the lifecycle hooks come from `node:test`, and coverage
comes from `--experimental-test-coverage` written as lcov for codecov.

Node.js 20 is end-of-life, so the floor moves to the oldest maintained LTS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
Git checks the fixture out with CRLF on Windows and ESLint keeps it, which
jest's snapshot serializer used to normalize away.

Drop the eslint version from the test matrix as well: it multiplied every
OS and Node.js combination by two for what the dedicated linters job
already covers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
@alexander-akait
alexander-akait merged commit b150ce0 into main Sep 7, 2026
13 checks passed
@alexander-akait
alexander-akait deleted the build/node-test-runner branch September 7, 2026 14:37
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