[QUESTION] How does one mock zip.js in Jest tests? #424
Unanswered
remarkablemark
asked this question in
Q&A
Replies: 2 comments 1 reply
-
If the web steam API is not available, then you should able to circumvent this issue by importing this module before running the tests: https://www.npmjs.com/package/web-streams-polyfill |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks! I ended up creating a module mock for the package: mkdir -p __mocks__/@zip.js/
echo "module.exports = {};" > __mocks__/@zip.js/zip.js.js |
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.
-
I'm using
zip.js
in my frontend project and I'm trying to write Jest tests but they're failing with:I'm using
jsdom
for my test environment.Is the best way to resolve this is to mock the node module? I have seen other projects provide a mock file for Jest.
Beta Was this translation helpful? Give feedback.
All reactions