Skip to content

test: migrate test suite from jest to the node:test runner#597

Open
alexander-akait wants to merge 3 commits into
mainfrom
claude/migrate-jest-to-node-tester-jChBi
Open

test: migrate test suite from jest to the node:test runner#597
alexander-akait wants to merge 3 commits into
mainfrom
claude/migrate-jest-to-node-tester-jChBi

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

Summary

use built-in node tester instead jest

What kind of change does this PR introduce?

test

Did you add tests for your changes?

this pr is only about test

Does this PR introduce a breaking change?

No

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

Nothing

Use of AI

Claude

- Replace jest globals and `expect` matchers with `node:test` and
  `node:assert` equivalents across all test files.
- Convert the five `toMatchSnapshot` assertions to inline
  `assert.deepStrictEqual` checks and drop the `__snapshots__` directory.
- Add `scripts/test.js` to run the suite with an explicit file list so
  `test/fixtures` is never executed as tests and behavior is identical on
  every supported Node.js version and OS.
- Wire coverage through `node --test --experimental-test-coverage` with the
  built-in lcov reporter and keep uploading to Codecov.
- Remove `jest`, `@types/jest` and `prettier-2`; update the CI matrix to
  Node.js 18-25 (coverage collected on 22+).
Copilot AI review requested due to automatic review settings May 28, 2026 17:27
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

⚠️ No Changeset found

Latest commit: cd88fb8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.05%. Comparing base (ec96727) to head (cd88fb8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
+ Coverage   96.54%   98.05%   +1.51%     
==========================================
  Files          50       47       -3     
  Lines        3036     9096    +6060     
  Branches      971        0     -971     
==========================================
+ Hits         2931     8919    +5988     
- Misses         89      177      +88     
+ Partials       16        0      -16     
Flag Coverage Δ
integration 98.05% <ø> (+1.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the test suite from Jest to Node's built-in node:test runner. All Jest globals (expect, toEqual, toBeNull, toMatchSnapshot, lifecycle hooks) are replaced with node:assert calls and node:test equivalents; snapshots are inlined; the CI matrix and dev dependencies are adjusted accordingly.

Changes:

  • Add scripts/test.js wrapper around node --test (explicit file enumeration) and rewire npm test* scripts; drop jest, @types/jest, prettier-2, and jest.config.js.
  • Convert every test/*.test.js to node:test/assert, replace (done) with (t, done), and inline former snapshot fixtures (alias, fallback, restrictions, exportsField, importsField); delete test/__snapshots__/.
  • Update CI matrix to Node 18–25 only, gate coverage to Node ≥22, and add ESLint/tsconfig overrides for tests using node:test.

Reviewed changes

Copilot reviewed 50 out of 52 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json, jest.config.js Drop Jest deps/config; route npm test through new script.
scripts/test.js New wrapper invoking node --test with an explicit file list.
.github/workflows/test.yml Drop old Node versions, split coverage vs. non-coverage runs.
eslint.config.mjs, tsconfig.types.test.json Allow modern Node builtins and drop jest types for tests.
test/*.test.js Replace Jest globals/matchers with assert/node:test; inline snapshots.
test/snapshots/*.snap Removed; expectations moved inline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/simple.test.js Outdated
Comment thread test/simple.test.js Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 138 untouched benchmarks


Comparing claude/migrate-jest-to-node-tester-jChBi (cd88fb8) with main (ec96727)

Open in CodSpeed

The node:test based suite requires Node.js 18+, but the library still
supports Node.js >= 10.13. Add `scripts/smoke-test.js`, which loads the
public entry point and performs sync/async resolves using only APIs
available on the oldest supported Node.js version, and run it in a
dedicated CI job (installing runtime dependencies only) across Node.js
10/12/14/16 on Linux and Windows.
`assert.ok(err instanceof Error)` already narrows `err` to `Error`, so the
following `/** @type {Error} */` cast was inert (and reflowed into a
misleading position). Remove it and access `err.message` directly.
Copilot AI review requested due to automatic review settings May 29, 2026 12:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants