Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update environment.md - mention the vitest's jsdom includes fetch #6429

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/guide/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
When using `jsdom` or `happy-dom` environments, Vitest follows the same rules that Vite does when importing [CSS](https://vitejs.dev/guide/features.html#css) and [assets](https://vitejs.dev/guide/features.html#static-assets). If importing external dependency fails with `unknown extension .css` error, you need to inline the whole import chain manually by adding all packages to [`server.deps.external`](/config/#server-deps-external). For example, if the error happens in `package-3` in this import chain: `source code -> package-1 -> package-2 -> package-3`, you need to add all three packages to `server.deps.external`.

Since Vitest 2.0.4 the `require` of CSS and assets inside the external dependencies are resolved automatically.

:::

::: info

Check failure on line 23 in docs/guide/environment.md

View workflow job for this annotation

GitHub Actions / Lint: node-latest, ubuntu-latest

Trailing spaces not allowed

The `jsdom` environment includes window methods such as `fetch()` that are not implemented in jsdom, if they exist in your node runtime.

:::

::: warning
Expand Down
Loading