-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Ipfs-http-client throws an error when running jest/jsdom unit tests #3238
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
I'm also affected by this.
The third line ( So it looks likely that the problem was introduced by ipfs/js-ipfs-utils#54 and has since been reverted/fixed in |
Ah, it works in ipfs-http-client@next (46.0.0-rc.2) |
- address jsdom use case as per ipfs/js-ipfs#3238 - remove onDownloadProgress since we don't need it
ipfs-http-client@46.0.0
Severity:
Medium
Description:
What you did:
Updated a dependency and tried to run unit tests with default jest configuration. Subdependency ipfs-http-client@40.1.0 updated to ipfs-http-client@46.0.0 and was imported
require('ipfs-http-client')
but not instantiated in tests.jest --env=node
works as a workaround, if you don't need DOMWhat happened:
Tests crash on initialization. Global
XMLHttpRequest
is defined (so it usesipfs-utils/src/http/fetch-browser.js
), but globalRequest
isn't (throwsReferenceError
).What you expected to happen
Expected ipfs-http-client to continue working with jest/jsdom
Steps to reproduce the error:
The text was updated successfully, but these errors were encountered: