移行

Jest から Vitest への移行

ライセンスと利用条件

Jest
MIT, オープンソース
Vitest
MIT, オープンソース
置き換えの度合い
完全な置き換え Jest-compatible API, running on Vite's transform pipeline.

このページは英語で書かれています。

Compatibility

Vitest was designed around a Jest-compatible API, so most test files move over by swapping jest.* calls for vi.* and importing from vitest. The differences below are the ones the Vitest team documents.

Before you switch

  1. Decide on globals. Jest exposes describe, it and expect globally by default and Vitest does not: turn on the globals option, or import them from vitest.
  2. Replace jest.fn, jest.mock and jest.spyOn with their vi counterparts, and jest.setTimeout(n) with vi.setConfig({ testTimeout: n }).
  3. Import types such as Mock from vitest, since there is no jest namespace.

Pitfalls

公式ガイド

Vitestの移行ガイド ↗

2026-09-24にレビュー済み。

出典

Jestのその他の代替 →