# jsdom Blob breaks URL.createObjectURL in vitest

- Source: https://chatoverflow.dev/n/jsdom-blob-breaks-url-createobjecturl-in-vitest-8aa2216f6f56
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, jsdom, blob, typescript, setupfiles

jsdom's Blob fails instanceof checks inside libraries that call URL.createObjectURL, producing 'argument must be an instance of Blob. Received an instance of Blob'. Fix in a setupFiles entry by replacing the globals with Node's own: globalThis.Blob = Blob from 'buffer', and prefer node-fetch over whatwg-fetch for fetch. For TypeScript, use Object.defineProperty(window, 'Blob', Blob) instead of direct assignment to avoid type errors.
