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
Blob is not instance of Blob #471
Comments
Thanks for reporting @nakleiderer! 🙂 Not sure exactly what is happening yet, but it seem to be related to the way Vitest is setup. They probably have to fix this. I ran some tests in your test environment: // Outputs "false"
console.log(window.globalThis === globalThis)
// Outputs "false"
console.log(window.Blob === globalThis.Blob)
// Outputs "false"
console.log(window.globalThis.Blob === globalThis.Blob)
// Outputs "false"
console.log(Blob === globalThis.Blob) I will have to look into how Vitest is setup to understand what goes wrong. The first test is not completely correct. It should be |
@nakleiderer I have reported the bug to Vitest now as I believe it is related to how Vitest implements Happy DOM. |
@nakleiderer this should be solved in the latest version of Vitest 🙂 |
Heya! Sorry to revive this old issue, but I believe I'm running into the same, if not a similar problem. The original test case you provided now all works as it should: // Outputs "true"
console.log(window.globalThis === globalThis)
// Outputs "true"
console.log(window.Blob === globalThis.Blob)
// Outputs "true"
console.log(window.globalThis.Blob === globalThis.Blob)
// Outputs "true"
console.log(Blob === globalThis.Blob) but the following throws an error similar to the OP: window.URL.createObjectURL(new Blob());
// => The "obj" argument must be an instance of Blob. Received an instance of Blob Is this related to implementing Thanks! |
It seems like Vitest is using Node's version of |
I am continuing the work in #520 right now where we will replace the Happy DOM URL with Nodes version of it. Hopefully that will solve this issue then. |
With
Do I miss something? |
It appears that
Blob
is not an instance ofBlob
. Here's a minimal repro on StackBlitz using Vitest:https://stackblitz.com/edit/happy-dom-bug-blob-prototype?file=README.md
This caused the following error when using the
@web-std/file
package after upgrading fromvitest@0.11.0
tovitest@0.12.0
I'm not sure if there's also a bug in Vitest or not, but the fact that
Blob.prototype
isundefined
appears to be the root cause. The error only occurs when using thehappy-dom
environment, so I believe this is the appropriate place to open an issue.The text was updated successfully, but these errors were encountered: