Modernize dev tooling: remove unused deps and migrate Jest to Vitest#1173
Merged
Conversation
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.
96750e5 to
a8c28a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;lintuses ESLint),nock(not imported by any test), andjest-util(redundant direct dep, already provided transitively). Removed the deadstandardconfig block.Jest → Vitest — replaced
jest+ts-jestwith Vitest 4, dropping@types/jest,eslint-plugin-jest,jest, andts-jest. This also removes their large transitive tree — including@babel/coreandjs-yaml, the sources of the recently fixed Dependabot alerts. Net dependency change: ~440 → ~215 packages.vitest.config.mtsusesglobals+ node environment. The.mtsextension loads the config as ESM, avoiding the deprecated Vite CJS config API.done-callback style to synchronous tests: Vitest passes aTestContext(notdone) as the first argument and has nodone.fail. Behavior is preserved.jest,fit,x*), addedvi.typesjest→vitest/globals; build scoped tosrc/so the new root config file is not pulled into thetscprogram.Test type-checking — Vitest transpiles tests via esbuild and does not type-check them (ts-jest did). To keep that coverage, the
testscript runsvitest run --typecheck. Addedtsconfig.vitest.json(extends the build config,noEmit,rootDir "."sotest/can be included alongsidesrc/), referenced fromtest.typecheck.tsconfig.Verification
npm run all(build → format → lint → package → test) passes: 4 test files / 10 tests, no type errors;npm run format-checkclean.npm ls @babel/core js-yaml ts-jest jest→ all absent from the lock file.vitest run --typecheckfails (exit 1) on an injected type error in a test file.vitestverified via--experimental-require-module(local Node is 22.9.0; CI runs Node 24, which supportsrequire(ESM)natively).