Skip to content

test: run the unit tests with Vitest instead of Jest - #64

Merged
pashidlos merged 1 commit into
masterfrom
test/vitest
Nov 3, 2026
Merged

pashidlos merged 1 commit into
masterfrom
test/vitest

Conversation

@pashidlos

Copy link
Copy Markdown
Member

Clears this repo's only open Dependabot alert: deepmerge GHSA-gcqx-w48m-w2h4 (low, dev). It comes from Jest 30's jest-config, and deepmerge has no patched release, so no bump or override removes it. Vitest's tree audits clean. Alerts: 1 → 0; npm audit: 6 low → 0.

Change

  • Jest, ts-jest, @types/jest and jest.config.js are gone. Vitest 5 runs the same specs (vitest.config.ts, lib/**/*.spec.ts).
  • The specs change only where the APIs differ: jest.* → vi.*, jest-mock's mocked → vi.mocked, and .mockImplementation() → .mockImplementation(() => {}). The top-level `jest.requireActual` becomes `vi.importActual` in a `beforeAll`, because top-level await does not compile under `module: commonjs`. No production code changes.
  • ts-jest used to type-check the specs; Vitest only strips types. So npm test runs tsc -p tsconfig.spec.json first.
  • The glob/minimatch overrides are dropped: only Jest needed them.
  • Dependabot: the "ts-jest supports TypeScript < 7 only" ignore is removed. TypeScript 7.0.2 type-checks this repo without errors.

Tests

  • Before (Jest): 17 passed. After (Vitest): 17 passed, same files and names.
  • Coverage (stmts/branch/funcs/lines): before 100/100/100/100, after 100/100/100/100. The uncovered line numbers are the same. The percentages differ only because ts-jest instrumented compiled JS, while Vitest instruments the TS source. There are no coverage thresholds in this repo, so nothing is lowered.

Release effect

None (test:). Can merge now.

🤖 Generated with Claude Code

Jest 30's jest-config depends on deepmerge 4.3.1 (GHSA-gcqx-w48m-w2h4),
which has no patched release, so the alert could not be cleared while
Jest stayed. Vitest's tree audits clean.

The specs change only where the APIs differ. `tsc -p tsconfig.spec.json`
runs before the tests, because ts-jest used to type-check the specs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pashidlos
pashidlos merged commit 742fa8c into master Nov 3, 2026
3 checks passed
@pashidlos
pashidlos deleted the test/vitest branch November 3, 2026 06:50
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 6.0.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant