@vitest/web-worker: How to pass File object to SharedWorker? #7514
heidemn-faro
started this conversation in
General
Replies: 1 comment
-
|
@heidemn-faro Hey, I am facing the same problem right now, any updates on this? Do you have a workaround for the tests? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
In our vitest tests, I'm trying to get a File object into our SharedWorker that is responsible for uploading.
The file object is sent via
this.#worker?.port.postMessage(message);...where
messageis a plain object containing a File and some parameters.What I see is that the SharedWorker doesn't well receive the File object, but instead an empty object with
file instanceof Filebeing false andfile.constructor.name === "Object".The code runs fine in the browser, there I can properly receive it and
file instanceof Fileis true.I already tried to mock
structuredClonein the tests, but seems like it is not called.Any idea how to get it working?
Libraries that we're using that might be relevant:
Beta Was this translation helpful? Give feedback.
All reactions