diff --git a/src/content/docs/en/guides/upgrade-to/v6.mdx b/src/content/docs/en/guides/upgrade-to/v6.mdx index 4318894f91161..255ba1da59093 100644 --- a/src/content/docs/en/guides/upgrade-to/v6.mdx +++ b/src/content/docs/en/guides/upgrade-to/v6.mdx @@ -1307,6 +1307,30 @@ export function getStaticPaths() { Learn more about [dynamic SSG routes with `getStaticPaths()`](/en/guides/routing/#static-ssg-mode). +### Changed: Astro components cannot be rendered in Vitest client environments (Container API) + + + +In Astro 5.x, rendering an Astro component on the client was forbidden. However we temporarily allowed this behavoir in Vitest client environments such as `jsdom` or `happy-dom` using the [experimental Container API](/en/reference/container-reference/). + +Astro 6.0 removes the ability to render Astro components in Vitest client environments: tests that render Astro components must now run in a server environment like `node`. + +#### What should I do? + +If you use Vitest to run tests that render Astro components in client environments like `jsdom` or `happy-dom`, update your Vitest config to use the `node` environment for these: +```ts title="vitest.config.ts" del={5} ins={6} +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'jsdom', + environment: 'node', + }, +}); +``` + +Learn more about [testing Astro components](/en/guides/testing/). + ### Changed: Integration hooks and HMR access patterns (Integration API)