Conversation
Jest requires --experimental-vm-modules for ESM support, relies on jest.unstable_mockModule for mocking ES modules, and needs ts-jest as a separate transform layer for TypeScript. This adds configuration complexity (NODE_OPTIONS, moduleNameMapper, tsconfig.test.json) and builds on unstable Node.js APIs. Vitest has native ESM and TypeScript support, stable ESM mocking via vi.mock(), and requires minimal configuration. Its Jest-compatible API (describe/it/expect) means existing tests need few changes. It replaces three dev dependencies (jest, ts-jest, @types/jest) with one (vitest). Additionally, Vitest is much faster than jest which will help running tests in agent sessions. node:test was considered as a zero-dependency alternative but requires rewriting all assertions from expect() to node:assert and needs a TypeScript loader. Given planned test coverage expansion, Vitest's lower migration cost and richer API make it the better choice.
Remove jest, ts-jest, @types/jest and add vitest, @types/node. Replace jest.config.ts with vitest.config.ts. Update tsconfig files and npm scripts accordingly. Vitest has native ESM and TypeScript support, eliminating the need for --experimental-vm-modules, ts-jest transforms, and moduleNameMapper workarounds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add explicit import of describe, it, expect from vitest. This file has no mocking — only the import line changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace @jest/globals with vitest imports. Convert jest.unstable_mockModule to vi.mock and jest.fn to vi.fn. The dynamic await import() pattern is preserved — it works with Vitest and ensures the mock is applied before module load. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add explicit import of describe, it, expect from vitest. This file has no mocking — only the import line changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All automated and manual verification checks pass: - 53 tests across 3 files pass with vitest - Build, format-check, and package all succeed - No jest packages remain in dependency tree Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The plan has been implemented. The thoughts could go out of date. Best to rebuild them in the moment.
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s TypeScript ESM test setup from Jest/ts-jest to Vitest to reduce configuration complexity and improve test execution speed.
Changes:
- Add Vitest configuration and switch npm test scripts to
vitest run. - Remove Jest configuration and Jest-specific TypeScript typings/config references.
- Update existing tests to use Vitest APIs (
vitestimports,vi.mock).
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
vitest.config.ts |
Adds Vitest test runner configuration (root under src, mock clearing). |
package.json |
Replaces Jest/ts-jest dependencies and scripts with Vitest equivalents. |
jest.config.ts |
Removes Jest configuration entirely. |
tsconfig.test.json |
Drops Jest typings/config inclusion for the test TS config. |
tsconfig.json |
Updates build excludes to avoid compiling the new Vitest config file. |
src/test/utils.test.ts |
Imports describe/it/expect from Vitest. |
src/test/backport.test.ts |
Imports describe/it/expect from Vitest. |
src/test/git.test.ts |
Replaces Jest ESM mocking with vi.mock and updates imports accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The outDir in tsconfig.test.json was a leftover reference to Jest. This path is unused (Vitest uses esbuild, not tsc, for test transformation) but renaming it avoids confusion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates the project’s TypeScript/ESM test setup from Jest + ts-jest to Vitest to reduce configuration complexity and improve test run performance.
Changes:
- Add
vitest.config.tsand switchpackage.jsontest scripts/devDependencies to Vitest. - Remove Jest configuration and Jest-specific TypeScript settings.
- Update existing tests to use Vitest APIs (
vi.mock,describe/it/expectimports).
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Introduces Vitest configuration (test root + mock behavior). |
| tsconfig.test.json | Removes Jest types/config include; adjusts test build output folder. |
| tsconfig.json | Replaces Jest config exclusion with Vitest config exclusion. |
| src/test/utils.test.ts | Imports Vitest test APIs. |
| src/test/git.test.ts | Replaces Jest ESM mocking with vi.mock and updates imports. |
| src/test/backport.test.ts | Imports Vitest test APIs. |
| package.json | Updates test scripts and replaces Jest/ts-jest deps with Vitest. |
| jest.config.ts | Removes Jest configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Jest requires
--experimental-vm-modulesfor ESM support, relies onjest.unstable_mockModulefor mocking ES modules, and needsts-jestas a separate transform layer for TypeScript. This adds configuration complexity (NODE_OPTIONS,moduleNameMapper,tsconfig.test.json) and builds on unstable Node.js APIs.Vitest has native ESM and TypeScript support, stable ESM mocking via
vi.mock(), and requires minimal configuration. Its Jest-compatible API (describe/it/expect) means existing tests need few changes. It replaces three dev dependencies (jest,ts-jest,@types/jest) with one (vitest). Additionally, Vitest is much faster than jest which will help running tests in agent sessions.node:testwas considered as a zero-dependency alternative but requires rewriting all assertions fromexpect()tonode:assertand needs a TypeScript loader. Given planned test coverage expansion, Vitest's lower migration cost and richer API make it the better choice.