docs icon indicating copy to clipboard operation
docs copied to clipboard

docs: document Vitest SSR environment requirement for Astro 6

Open Ntale3 opened this issue 3 weeks ago • 4 comments

Description (required)

This PR documents a breaking change in Astro 6 where rendering .astro components in Vitest tests now requires using an SSR environment (node) instead of client environments (jsdom/happy-dom).

The temporary workaround added in Astro 5.x has been removed to ensure tests run in an environment that matches Astro's SSR build process.

What's included:

  • Clear identification of who is affected (all three conditions must apply: Vitest + Container API + client environment)
  • Explanation that users not rendering Astro components or already using node environment need no changes
  • Step-by-step migration guide with code examples
  • Workspace configuration example for projects needing multiple test environments

Related issues & labels (optional)

  • Closes withastro/astro#14895

For Astro version: 6.0. See astro PR #14941.

Ntale3 avatar Nov 27 '25 15:11 Ntale3

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
Latest commit 1c8627553947403b60f8fe5058d664ce6d7b5564
Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/69458c42a02473000870a566
Deploy Preview https://deploy-preview-12808--astro-docs-2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Nov 27 '25 15:11 netlify[bot]

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/upgrade-to/v6.mdx Localization changed, will be marked as complete.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

astrobot-houston avatar Nov 27 '25 15:11 astrobot-houston

@delucis I'd really appreciate your guidance and review on this PR. If there's anything that needs adjustment to better match the docs style or if I've missed any important details, please let me know. Happy to iterate on this!

Ntale3 avatar Nov 27 '25 15:11 Ntale3

Just resolved the conflicts here, and noting that it looks like we're waiting on movement on the implementation PR which is marked as needs response. Just want to make sure the feature PR is active and the author is addressing feedback!

sarah11918 avatar Dec 10 '25 17:12 sarah11918

Just a note that I have:

  • committed a suggestion to update the title of this entry, so that I could also update the link to the v6 upgrade guide in the astro PR
  • reviewed and lightly edited Florian's suggestions so that all suggestions can be accepted as is
  • removed the merge on release label because it seems like the code was already merged into next? (but, without a changeset which is now the PR linked in the description above). This can likely merge at any time

Looks like what's needed here in order to merge:

  • [x] all of Florian's suggestions should be committed
  • [ ] according to Florian, the example is deprecated usage and should be updated to show current usage

sarah11918 avatar Dec 19 '25 13:12 sarah11918

Update: We are merging this because there is going to be a release with the merged code so we need something published in the upgrade guide!

If someone wants to improve this entry at a later date, then they can do so in another PR to the v6 branch! But we at least need something published now. :smile:

sarah11918 avatar Dec 19 '25 17:12 sarah11918

@sarah11918 am so sorry for the delay i wasnt online at that time. Thank you guys for Helping out!

Ntale3 avatar Dec 19 '25 22:12 Ntale3