diff --git a/docs/guide/browser/index.md b/docs/guide/browser/index.md index e15c53a67..45451614c 100644 --- a/docs/guide/browser/index.md +++ b/docs/guide/browser/index.md @@ -44,7 +44,7 @@ If you want to just preview how your tests look, you can use the `preview` provi npm install -D vitest @vitest/browser-preview ``` ```bash [yarn] -yarn add -D vitest @vitest/browser-preview +yarn add -D vitest vite @vitest/browser-preview ``` ```bash [pnpm] pnpm add -D vitest @vitest/browser-preview @@ -68,7 +68,7 @@ If you don't already use one of these tools, we recommend starting with Playwrig npm install -D vitest @vitest/browser-playwright ``` ```bash [yarn] -yarn add -D vitest @vitest/browser-playwright +yarn add -D vitest vite @vitest/browser-playwright ``` ```bash [pnpm] pnpm add -D vitest @vitest/browser-playwright @@ -85,7 +85,7 @@ bun add -D vitest @vitest/browser-playwright npm install -D vitest @vitest/browser-webdriverio ``` ```bash [yarn] -yarn add -D vitest @vitest/browser-webdriverio +yarn add -D vitest vite @vitest/browser-webdriverio ``` ```bash [pnpm] pnpm add -D vitest @vitest/browser-webdriverio diff --git a/docs/guide/index.md b/docs/guide/index.md index f8ee42ca6..ad042037e 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -28,7 +28,7 @@ You can try Vitest online on [StackBlitz](https://vitest.new). It runs Vitest di npm install -D vitest ``` ```bash [yarn] -yarn add -D vitest +yarn add -D vitest vite ``` ```bash [pnpm] pnpm add -D vitest diff --git a/docs/guide/migration/index.md b/docs/guide/migration/index.md index 752c57b2a..300ae6834 100644 --- a/docs/guide/migration/index.md +++ b/docs/guide/migration/index.md @@ -16,6 +16,14 @@ outline: deep Vitest 5.0 requires Vite >= 6.4.0 and Node.js >= 22.12.0. Before proceeding with any other migration steps, ensure your environment meets these requirements. Running Vitest 5.0 on older versions of Vite or Node.js is not supported and may result in unexpected errors. ::: +## Yarn Users Must Install `vite` Explicitly + +`vite` is no longer a direct dependency of `vitest`. It is now a required peer dependency, so the version of Vite used by Vitest is the one installed in your project. npm, pnpm, Bun, and Deno install peer dependencies automatically. Yarn does not, so after the upgrade Vitest cannot resolve `vite` unless it is listed in your `package.json`: + +```bash +yarn add -D vite +``` + ## `clearMocks` is Enabled by Default [`clearMocks`](/config/clearmocks) now defaults to `true`: Vitest calls [`vi.clearAllMocks()`](/api/vi#vi-clearallmocks) before every test, clearing the recorded history of every mock while leaving implementations intact.