Migrate from Vitest 4
@repobuddy/vitest 2.x has vitest and @vitest/browser-playwright peer ranges of ^4.0.15. Version 3, the next
major release, moves both to ^5.0.0 and supports Vitest 5 only. The preset source is unchanged; only the peer ranges
move. To stay on Vitest 4, keep @repobuddy/vitest on 2.x.
-
Upgrade
@repobuddy/vitest,vitest, and (if you run browser tests)@vitest/browser-playwrighttogether:Terminal window pnpm add -D @repobuddy/vitest@^3 vitest@^5 @vitest/browser-playwright@^5 -
Keep your preset calls as they are.
nodeTestPreset()andbrowserTestPreset()take the same options. -
Follow Vitest’s own migration notes for changes in your test code and other Vitest options.
What changed in the presets
Section titled “What changed in the presets”browserTestPreset()runs in Vite’sprephase (since 2.4.1). Vitest 5 sets up browser mode in its ownpreplugin, which readstest.browser.enabledbefore normal plugins run. Without this, Vitest 5 fails with “The browser server was not initialized”. A hand-written browser plugin that setstest.browser.enabledneedsenforce: 'pre'for the same reason.
Verify
Section titled “Verify”- Run
pnpm ls vitest @vitest/browser-playwright. Both report a 5.x version. - Run your tests. The browser project starts without “The browser server was not initialized”.
Related
Section titled “Related”browserTestPreset()@repobuddy/vitest: supported versions