Skip to content

Conversation

@sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Oct 24, 2025

Description

Fixes #8777
Fixes #8788

We removed fetch related globals from the KEYS to support jsdom, but happy-dom does define them properly, so they need to stay in the happy-dom environment.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@sheremet-va sheremet-va merged commit 0fb74bd into vitest-dev:main Oct 24, 2025
13 of 14 checks passed
@sheremet-va sheremet-va deleted the fix/happy-dom-fetch-globals branch October 24, 2025 12:43
'Headers',
'AbortController',
'AbortSignal',
'URL',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sheremet-va After upgrading to vitest 4.0.3 my happy-dom-based tests are now failing with:

ReferenceError: URL is not defined
 ❯ new Location ../../node_modules/.pnpm/[email protected]/node_modules/happy-dom/lib/location/Location.js:26:25
 ❯ new BrowserWindow ../../node_modules/.pnpm/[email protected]/node_modules/happy-dom/lib/window/BrowserWindow.js:708:41
 ❯ new Window ../../node_modules/.pnpm/[email protected]/node_modules/happy-dom/lib/window/Window.js:39:9
 ❯ new GlobalWindow ../../node_modules/.pnpm/[email protected]/node_modules/happy-dom/lib/window/GlobalWindow.js:10:16
 ❯ Object.setup ../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/index.DON9WL-E.js:338:69
 ❯ processTicksAndRejections node:internal/process/task_queues:105:5
 ❯ withEnv ../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/base.RFExFinv.js:55:14
 ❯ run ../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/base.RFExFinv.js:72:144
 ❯ runBaseTests ../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/base.RFExFinv.js:122:2
 ❯ executeTests ../../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vitest/dist/chunks/init-forks.WSf5dRNP.js:24:4

Could it be related to this change? Downgrading to vitest 4.0.2 makes the issue go away.

Copy link

@andrewbrennanfr andrewbrennanfr Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same failure for me ☝️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, create an issue with a reproduction. A quick run of our happy-dom tests didn't show an error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok done here #8882 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4 regression: something is wrong with happy-doms Blob vitest@4 problem with MSW + Axios

3 participants