-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
TypeError: The "obj" argument must be an instance of Blob. Received an instance of Blob #3985
Comments
Start a new pull request in StackBlitz Codeflow. |
I receive the same error originating from Works fine in vitest 0.33.x. Breaks in 0.34.x. Edit: I got around this by stubbing the function in my test setup file. window.URL.createObjectURL = vi.fn(); Edit2: Arguably better stub... vi.spyOn(window.URL, "createObjectURL").mockImplementation(() => "http://fake.url"); |
You start in one corner and then you end up painting the entire wall. This PR achieves the following: - replaces `npm` with `pnpm` - replaces `jest` ecosystem with `vitest` (2x speed for me locally) - enable coverage for tests (we can add codecov as a followup) - replace `nock`/`isomorphic-fetch` with `msw` - improve the tests where `fetch` would fail - modernize `tsconfig.json` - update CI to use `pnpm` (except releases, will be done separately) - fix feedback from `tsc` based on updated rulesets - change how we mount React so we go full 18 mode (it dropped back to React 17 mode) - remove the publish script - switch `ts-loader` for `tslib` - generate DTS via a vite plugin - bump all packages to their latest versions (except vitest which has a bug in the `0.34` series) PR: #197 Refs: vitest-dev/vitest#3985
So, it worked fine before because Vitest was using jsdom's URL which actually doesn't support To fix this, we stopped using jsdom's URL, and now only rely on Node.js URL. Looking back, I think this was the wrong decision and we will be reverting it which might introduce more problems when working with Node.js API, but it will be more consistent with how it works in the browser. To support |
Describe the bug
Starting with 0.34, tests are failing with
TypeError: The "obj" argument must be an instance of Blob. Received an instance of Blob
. While I can add node Blob in global setup like in #1377 (comment) , this creates inconsistent behaviors for the test vs. web based execution.Reproduction
https://stackblitz.com/edit/vitejs-vite-aubhih?file=package.json,main.jsx,main.test.jsx,vite.config.js&terminal=dev
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: