-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
request.formData() fails with vitest and file #2166
Comments
Hi, @haakonph. Thanks for reporting this. I will take a look once I have a minute but generally we have a stance that Jest issues are not addressed. If I am able to reproduce this in raw Node.js or with Vitest, then I will consider this a bug. If this is only reproducible for Jest/JSDOM, I will close this as wont-fix. |
@haakonph I ran into this today, too, but was able to solve it with the polyfill instructions. In case it helps, my
|
@kettanaito Hi, sorry i was a bit to fast with my copy pasting. The issue is with vitest and when the body contains a file. I oppdated the issue. I am not able to reproduce it without vitest. |
We are also running into this issue with msw, we are also running in an environment that loads jsdom, so this might be an interplay between msw, jsdom and a newer undici version? Any Node.js version after As a workaround we are currently pinned to Node.js |
Same problem here. Node v20.14.0, msw 2.3.1, vitest. Downgraded node to 20.12.2, and now it works again. |
I had the same problem Node v20.15.1, msw 2.3.2, vitest 2.0.4. Downgraded node to 20.12.2 for now to solve |
I also had the same issue, the request.formData() it was just ignored and didn't throw any error. I downgrade to 20.12.2 and then it worked. |
If the issue only happens on particular version of Node.jsPlease downgrade to the Node.js version where such issue doesn't happen (v20.12.2 based on the comments). Please raise this issue with Undici (the fetch and If the issue only happens in JSDOMThen it's a bug in JSDOM. Either migrate to HappyDOM or run your tests in the actual browser, where |
Prerequisites
Environment check
msw
versionNode.js version
v22.2.0
Reproduction repository
https://github.com/haakonph/msw-examples
Reproduction steps
alter the example to use a request with a file: (as in the example repo)
in the with-vitest exmple,
run npm i
and run the 'fetches the user info' test
you need to add a file to the request to get it to fail
if you run with npm v20.0.0 it works with jsdom but not without.
it works with jest-jsdom.
Current behavior
with vitest-jsdom it time out waiting to get the request
with vitest without vitestjsdom you get a 500 response.
Expected behavior
get a 200 response as you get with examples/with-jest-jsdom example
The text was updated successfully, but these errors were encountered: