Skip to content

Remove jest; migrate JS tests to node:assert / node --test#35

Merged
stephenberry merged 1 commit into
mainfrom
js-remove-jest-zero-deps
May 29, 2026
Merged

Remove jest; migrate JS tests to node:assert / node --test#35
stephenberry merged 1 commit into
mainfrom
js-remove-jest-zero-deps

Conversation

@stephenberry

Copy link
Copy Markdown
Member

Summary

The JavaScript package's only dependency was jest, which pulled in a transitive tree (minimatch, picomatch, brace-expansion) that repeatedly surfaced ReDoS advisories requiring version overrides in package.json. This migrates the test suite to Node's built-in test runner so the package becomes zero-dependency and the alerts go away at the root.

Changes

  • beve.test.js: jest matchers → node:assert (strictEqual, deepStrictEqual, notStrictEqual). A small assertClose helper covers the float comparisons node:assert lacks. Test names and structure are unchanged.
  • package.json: removed the jest devDependency and the minimatch/picomatch/brace-expansion overrides; test script is now node --test.
  • package-lock.json: removed (no dependencies left to lock), along with its .gitignore un-ignore rule.
  • CI (.github/workflows/test.yml): dropped the npm cache and the npm ci step — both require a lockfile and there is nothing to install. node:test/node:assert are stable in the Node 20 the workflow uses.

Verification

node --test87/87 tests pass, confirmed with no node_modules and no lockfile present (i.e. nothing to install). No expect(/jest matchers remain.

The package is now zero-dependency and the tests are pure standard library.

The JavaScript package's only dependency was jest, which pulled in a
transitive tree (minimatch, picomatch, brace-expansion) that repeatedly
surfaced ReDoS advisories requiring version overrides.

Migrate the test suite to Node's built-in test runner:
- beve.test.js: jest matchers -> node:assert (strictEqual,
  deepStrictEqual, notStrictEqual); a small assertClose helper covers
  the float comparisons node:assert lacks.
- package.json: drop the jest devDependency and the minimatch/picomatch/
  brace-expansion overrides; test script is now `node --test`.
- Remove package-lock.json (no dependencies left to lock) and its
  .gitignore un-ignore rule.
- CI: drop the npm cache and `npm ci` step; both require a lockfile and
  there is nothing to install. node:test/node:assert are stable in the
  Node 20 the workflow uses.

The package is now zero-dependency and the tests are pure stdlib. All 87
tests pass via `node --test`.
@stephenberry stephenberry merged commit 3b05f44 into main May 29, 2026
1 check passed
@stephenberry stephenberry deleted the js-remove-jest-zero-deps branch May 29, 2026 21:22
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