@vitest/web-worker: How to pass File object to SharedWorker? #7514
heidemn-faro
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
message
is 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 File
being false andfile.constructor.name === "Object"
.The code runs fine in the browser, there I can properly receive it and
file instanceof File
is true.I already tried to mock
structuredClone
in 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