-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
I'm using React Router as a...
library
Reproduction
Go to https://github.com/digitalservicebund/a2j-rechtsantragstelle, clone the repo, install the libraries and run npm run test app/components/userFeedback/__test__/RatingBox.test.tsx.
With the node version from and below 22.14.0 it doesn't fail, only with version 22.15.0
it("should call onSubmit method when clicks on the Yes button", () => {
const onSubmitMock = vitest.fn();
const RatingBoxWithRouteStub = createRoutesStub([
{
path: "/",
Component: () => (
<RatingBox heading="heading" url="url" onSubmit={onSubmitMock} />
),
},
{
path: "/action/send-rating",
action() {
return {};
},
},
]);
const { getByText } = render(<RatingBoxWithRouteStub />);
fireEvent.click(getByText(YES_RATING));
expect(onSubmitMock).toBeCalled();
});
System Info
System:
OS: macOS 13.5
CPU: (10) arm64 Apple M2 Pro
Memory: 72.92 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.0 - ~/.nvm/versions/node/v22.15.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v22.15.0/bin/npm
pnpm: 9.12.1 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 135.0.7049.115
Edge: 135.0.3179.98
Safari: 17.4
npmPackages:
@react-router/dev: ^7.5.3 => 7.5.3
@react-router/express: ^7.5.3 => 7.5.3
@react-router/fs-routes: ^7.5.3 => 7.5.3
@react-router/node: ^7.5.3 => 7.5.3
react-router: ^7.5.3 => 7.5.3
vite: ^6.3.3 => 6.3.3Used Package Manager
npm
Expected Behavior
Test pass without error
Actual Behavior
Test is failing with the error
TypeError: Request constructor: Expected init.body ("URLSearchParams {}") to be an instance of URLSearchParams.
❯ Object.webidl.errors.exception node:internal/deps/undici/undici:3610:14
❯ Object.URLSearchParams node:internal/deps/undici/undici:3816:31
❯ Object.webidl.converters.XMLHttpRequestBodyInit node:internal/deps/undici/undici:9411:34
❯ webidl.converters.BodyInit node:internal/deps/undici/undici:9422:32
❯ node:internal/deps/undici/undici:3870:16
❯ Object.RequestInit node:internal/deps/undici/undici:3852:21
❯ new Request node:internal/deps/undici/undici:9577:34
❯ createClientSideRequest node_modules/react-router/dist/development/index.js:4448:10
❯ handleFetcherAction node_modules/react-router/dist/development/index.js:2037:24
❯ Object.fetch2 [as fetch] node_modules/react-router/dist/development/index.js:1986:13
This error originated in "app/components/userFeedback/test/RatingBox.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running