Skip to content

Modernize dev tooling: remove unused deps and migrate Jest to Vitest#1173

Merged
ChanTsune merged 3 commits into
masterfrom
chore/modernize-devtools-cleanup-vitest
Jul 3, 2026
Merged

Modernize dev tooling: remove unused deps and migrate Jest to Vitest#1173
ChanTsune merged 3 commits into
masterfrom
chore/modernize-devtools-cleanup-vitest

Conversation

@ChanTsune

@ChanTsune ChanTsune commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Modernize dev tooling: remove unused dev dependencies, then migrate the test runner from Jest to Vitest (with type-checking of tests preserved).

Notes

Cleanup — dropped standard (declared but never run by any script; lint uses ESLint), nock (not imported by any test), and jest-util (redundant direct dep, already provided transitively). Removed the dead standard config block.

Jest → Vitest — replaced jest + ts-jest with Vitest 4, dropping @types/jest, eslint-plugin-jest, jest, and ts-jest. This also removes their large transitive tree — including @babel/core and js-yaml, the sources of the recently fixed Dependabot alerts. Net dependency change: ~440 → ~215 packages.

  • vitest.config.mts uses globals + node environment. The .mts extension loads the config as ESM, avoiding the deprecated Vite CJS config API.
  • The two tests are converted from Jest's done-callback style to synchronous tests: Vitest passes a TestContext (not done) as the first argument and has no done.fail. Behavior is preserved.
  • ESLint: removed the jest plugin and jest-only globals (jest, fit, x*), added vi.
  • tsconfig: types jestvitest/globals; build scoped to src/ so the new root config file is not pulled into the tsc program.

Test type-checking — Vitest transpiles tests via esbuild and does not type-check them (ts-jest did). To keep that coverage, the test script runs vitest run --typecheck. Added tsconfig.vitest.json (extends the build config, noEmit, rootDir "." so test/ can be included alongside src/), referenced from test.typecheck.tsconfig.

Verification

  • npm run all (build → format → lint → package → test) passes: 4 test files / 10 tests, no type errors; npm run format-check clean.
  • npm ls @babel/core js-yaml ts-jest jest → all absent from the lock file.
  • Verified vitest run --typecheck fails (exit 1) on an injected type error in a test file.
  • Local vitest verified via --experimental-require-module (local Node is 22.9.0; CI runs Node 24, which supports require(ESM) natively).

ChanTsune added 3 commits July 4, 2026 00:03
Drop standard, nock, and jest-util. standard was declared but never run
by any script (lint uses eslint); nock is not imported by any test; and
jest-util was a redundant direct dependency already provided transitively
by jest. Also removes the dead standard config block.
Replace jest + ts-jest with Vitest 4. This drops the @types/jest,
eslint-plugin-jest, jest, and ts-jest dev dependencies (and their large
transitive tree, including @babel/core and js-yaml, the sources of the
recent Dependabot alerts).

- Add vitest.config.mts (globals, node environment). The .mts extension
  loads the config as ESM, avoiding the deprecated Vite CJS config API.
- Convert the two tests from Jest's done-callback style to synchronous
  tests; Vitest passes a TestContext (not done) as the first argument,
  and has no done.fail. Behavior is preserved.
- eslint: drop the jest plugin and jest-only globals (jest, fit, x*),
  add vi.
- tsconfig: types jest -> vitest/globals; scope build to src/ so the new
  root config file is not pulled into the tsc program.

Vitest does not type-check test files (esbuild transpile only); tsc
covers src.
Vitest transpiles tests with esbuild and does not type-check them, unlike
ts-jest. Restore type coverage for test files by enabling Vitest's
typecheck (tsc) in the test script.

- Add tsconfig.vitest.json (extends the build config, noEmit, rootDir '.'
  so test/ can be included alongside src/).
- Point test.typecheck.tsconfig at it in vitest.config.mts.
- test script: vitest run --typecheck.
@ChanTsune ChanTsune force-pushed the chore/modernize-devtools-cleanup-vitest branch from 96750e5 to a8c28a0 Compare July 3, 2026 15:05
@ChanTsune ChanTsune merged commit 344cb72 into master Jul 3, 2026
8 checks passed
@ChanTsune ChanTsune deleted the chore/modernize-devtools-cleanup-vitest branch July 3, 2026 15:08
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