Skip to main content

Scope

Supported

Vitestify ships four packs — core, jest, nx, and angular-cli.

Core

  • Generate vitest.config.mts, install dependencies, and pick environment (jsdom, node, etc.) from project heuristics.
  • Clone Jest setup files for Vitest (strips jest-preset-angular usage).
  • Set tsconfig.spec.json module to preserve when it was commonjs.
  • Add framework setup when detected — Angular (Analog), React (@vitejs/plugin-react), Testing Library cleanup.
  • Guard @testing-library/jest-dom imports so Jest and Vitest can share setup files.

Jest

  • Rename Jest tests to .jest.cts / .jest.tsx so Vitest skips them while config is set up.
  • Point Jest testMatch at .jest extensions.
  • Rewrite common Jest APIs, mocks, snapshots, and types to Vitest.
  • Rename migrated tests back to .spec.*, run Vitest, and roll back failures to .jest.*.

Nx

  • Rename the test target to jest in project.json.
  • Rename @nx/jest/plugin's test target to jest, and add @nx/vitest.
  • Remove the legacy test target from project.json once Vitest provides one.
  • Set watch: false in generated Vitest config for Nx CI.

Angular CLI

  • Swap @angular-builders/jest:run for @analogjs/vitest-angular:test.

🚧 Future Work

Transform reference

Internal transform ids, useful when reading CLI output or debugging a run:

Core
  • setup-files — clones Jest setup files for Vitest and strips jest-preset-angular
  • testing-library-jest-dom — wraps @testing-library/jest-dom imports so they only load under Jest
  • rename-spec-to-jest — renames Jest tests to .jest.cts / .jest.tsx
  • tsconfig — sets tsconfig.spec.json module to preserve when it was commonjs
  • vitest-config — generates vitest.config.mts, installs dependencies, and adds framework setup when detected
Jest
  • config-test-match — points Jest testMatch at .jest extensions
  • jest-test — orchestrates test rewrites, runs Vitest, and rolls back on failure
    • jest-globals-import — rewrites @jest/globals imports to vitest
    • jest-mock — rewrites jest.mock and related mock APIs to vi
    • jest-set-mock — rewrites jest.setMock to vi.mock
    • jest-set-timeout — rewrites jest.setTimeout to vi.setConfig({ testTimeout })
    • jest-types — rewrites Jest type references to Vitest equivalents
    • jest-vi — rewrites jest.* calls to vi.*
    • jest-focus-skip-shorthand — rewrites fit / xit shorthands to it.only / it.skip
    • snap — normalizes Jest snapshot formatting to Vitest
    • vitest-imports — adds missing vitest imports for globals in use
    • rename-jest-to-spec — renames .jest.* tests back to .spec.* after rewrite
Nx
  • nx-jest-target — renames the test target to jest in project.json
  • nx-plugins — renames @nx/jest/plugin's target to jest and adds @nx/vitest
  • nx-project-json — removes the legacy test target from project.json
  • nx-vitest-watch — sets watch: false in Vitest config for Nx CI
Angular CLI
  • angular-builder-jest — swaps the Angular Jest builder for Analog Vitest