-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
Description
Describe the bug
I wanted to open the bug report with jsdom but I failed to reproduce the error without vitest so here we go.
When you are using Node 22.15.0 and you are using "environment": "jsdom" in vitest.config.ts you cannot construct Request objects with URLSearchParams bodies or else TypeError will be thrown:
TypeError: Request constructor: Expected init.body ("URLSearchParams {}") to be an instance of URLSearchParams.
You can successfully construct Request objects again when you override globalThis.URLSearchParams with node:urls URLSearchParams.
Reproduction
The StackBlitz here just presents the setup. I cannot change the Node version in StackBlitz to 22.15.0. And because of this the bug will not show up.
System Info
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1365U
Memory: 2.69 GB / 7.59 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 23.8.0 - /run/user/1000/fnm_multishells/86411_1745923856293/bin/node
npm: 10.9.2 - /run/user/1000/fnm_multishells/86411_1745923856293/bin/npm
pnpm: 10.4.1 - /run/user/1000/fnm_multishells/86411_1745923856293/bin/pnpm
npmPackages:
vitest: ^3.1.2 => 3.1.2Used 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