Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeJS and Electron conflict #82

Open
xmaysonnave opened this issue Dec 3, 2020 · 4 comments
Open

NodeJS and Electron conflict #82

xmaysonnave opened this issue Dec 3, 2020 · 4 comments
Assignees
Labels
kind/enhancement A net-new feature or improvement to an existing feature status/ready Ready to be worked

Comments

@xmaysonnave
Copy link

Env:

  • Debian Buster
  • latest nvm
  • latest yarn
  • node v15
  • latest ipfs-core

I try to use js-ipfs while testing with NodeJS.
As a dependency of ipfs-core, ipfs-utils is installed (dev dependency)
https://github.com/ipfs/js-ipfs-utils/blob/master/src/http/fetch.js

This code check whether or not XMLHttpRequest is available in node and redirect to fetch.browser when available.
However my environment is node and ipfs-utils crashes as fetch.browser requires the global browser fetch.
I could suggest to enhance the initial statement with the following to redirect to fetch.node

if (typeof XMLHttpRequest === 'function' && typeof fetch === 'function') {
  module.exports = require('./fetch.browser')

Thanks

@xmaysonnave xmaysonnave added the need/triage Needs initial labeling and prioritization label Dec 3, 2020
@welcome
Copy link

welcome bot commented Dec 3, 2020

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@xmaysonnave
Copy link
Author

jest is responsible of this behaviour.
migrated jest tests to chai, mocha and sinon.
no more issues

@achingbrain
Copy link
Member

Thanks for following up. I think it'd still be a good idea to expand the feature detection as suggested and issues with Jest do come up from time to time.

@achingbrain achingbrain added kind/enhancement A net-new feature or improvement to an existing feature status/ready Ready to be worked and removed need/triage Needs initial labeling and prioritization labels Dec 14, 2020
@xmaysonnave
Copy link
Author

Thanks for your feedback.
ipfs-provider is using Jest.
This is the reason I started to use it a while back.
Probably an input in a knowledge base could be interesting as known issues.
I enjoy spawning javascript Ipfs server in my tests, great feature.
Feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

3 participants