-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
Description
Describe the bug
When using vitest@4.0.3 & the latest version of happy-dom I encounter the error URL is not defined.
I have this in my professional project & am not the only one (see here).
As requested I'm opening an issue here.
ReferenceError: URL is not defined
❯ new Location node_modules/.pnpm/happy-dom@20.0.10/node_modules/happy-dom/lib/location/Location.js:26:25
❯ new BrowserWindow node_modules/.pnpm/happy-dom@20.0.10/node_modules/happy-dom/lib/window/BrowserWindow.js:708:41
❯ new Window node_modules/.pnpm/happy-dom@20.0.10/node_modules/happy-dom/lib/window/Window.js:39:9
❯ new GlobalWindow node_modules/.pnpm/happy-dom@20.0.10/node_modules/happy-dom/lib/window/GlobalWindow.js:10:16
❯ Object.setup node_modules/.pnpm/vitest@4.0.5_@types+node@24.9.1_happy-dom@20.0.10_jsdom@20.0.3_sass@1.93.2_stylus@0.57.0_terser@5.38.2_yaml@2.8.1/node_modules/vitest/dist/chunks/index.DON9WL-E.js:338:69
❯ processTicksAndRejections node:internal/process/task_queues:105:5
❯ withEnv node_modules/.pnpm/vitest@4.0.5_@types+node@24.9.1_happy-dom@20.0.10_jsdom@20.0.3_sass@1.93.2_stylus@0.57.0_terser@5.38.2_yaml@2.8.1/node_modules/vitest/dist/chunks/base.RFExFinv.js:55:14
❯ run node_modules/.pnpm/vitest@4.0.5_@types+node@24.9.1_happy-dom@20.0.10_jsdom@20.0.3_sass@1.93.2_stylus@0.57.0_terser@5.38.2_yaml@2.8.1/node_modules/vitest/dist/chunks/base.RFExFinv.js:72:144
❯ runBaseTests node_modules/.pnpm/vitest@4.0.5_@types+node@24.9.1_happy-dom@20.0.10_jsdom@20.0.3_sass@1.93.2_stylus@0.57.0_terser@5.38.2_yaml@2.8.1/node_modules/vitest/dist/chunks/base.RFExFinv.js:122:2
❯ executeTests node_modules/.pnpm/vitest@4.0.5_@types+node@24.9.1_happy-dom@20.0.10_jsdom@20.0.3_sass@1.93.2_stylus@0.57.0_terser@5.38.2_yaml@2.8.1/node_modules/vitest/dist/chunks/init-forks.WSf5dRNP.js:24:4
Reproduction
Here is a reproduction of this case with 4.0.3
Specifically the two options added to the vite.config are
isolate: false,
fileParallelism: false,
A version with 4.0.2 works.
System Info
System:
OS: macOS 26.0.1
CPU: (8) arm64 Apple M1
Memory: 705.83 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.5.0 - /Users/Andrew/.nvm/versions/node/v24.5.0/bin/node
Yarn: 1.22.22 - /Users/Andrew/.nvm/versions/node/v24.5.0/bin/yarn
npm: 11.5.1 - /Users/Andrew/.nvm/versions/node/v24.5.0/bin/npm
pnpm: 10.14.0 - /Users/Andrew/Library/pnpm/pnpm
bun: 1.3.1 - /Users/Andrew/.bun/bin/bun
Watchman: 2025.03.10.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 141.0.7390.108
Firefox: 144.0.2
Safari: 26.0.1Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable