Unit Testing: Blob is not defined #312
Replies: 7 comments 1 reply
-
this is the line im executing: |
Beta Was this translation helpful? Give feedback.
-
Did you import zip.js asynchonously and inject |
Beta Was this translation helpful? Give feedback.
-
I was able to make it work with blob-polyfill. And then I also had to use jsdom to replace FileReader from window.FileReader |
Beta Was this translation helpful? Give feedback.
-
That's interesting, I was not expecting that you would need a |
Beta Was this translation helpful? Give feedback.
-
I'm meaning that if |
Beta Was this translation helpful? Give feedback.
-
Note that you don't need to import zip.js asynchronously in Node.js with the version 2.4.5. |
Beta Was this translation helpful? Give feedback.
-
I'm moving this issue to the Discussion tab |
Beta Was this translation helpful? Give feedback.
-
trying to unit test when I use the BlobReader. I know Blob is a Web-API, and nodejs doesnt have access to it. Ive been able to stub it within my JSX file, but when Zip.js runs, it doesnt appear to have access to my stub. Any ideas how to unit test this?
ReferenceError: Blob is not defined
at t (file:///c:/ws/Insight/wordaddin/node_modules/@zip.js/zip.js/lib/z-worker-inline.js:1:86)
at file:///c:/ws/Insight/wordaddin/node_modules/@zip.js/zip.js/lib/zip-fs.js:44:1
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at ESMLoader.import (node:internal/modules/esm/loader:281:24)
at importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
Beta Was this translation helpful? Give feedback.
All reactions