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

support for node-fetch ? #5

Closed
alfonsodev opened this issue Oct 20, 2016 · 2 comments
Closed

support for node-fetch ? #5

alfonsodev opened this issue Oct 20, 2016 · 2 comments

Comments

@alfonsodev
Copy link

alfonsodev commented Oct 20, 2016

Hi, I couldn't make this package work on nodejs to mock 'node-fetch' package.
Could you give me some directions so that I can contribute to make this package work for nodejs too ?
Thanks!

[updates]
I found this configuration works with nodejs
package.json

"jset": {
    "testEnvironment": "node",
//setupJest.js
import fetch from 'jest-fetch-mock'
jest.setMock('node-fetch', fetch)

The problem now is that Request and Response are not present in nodejs
I think it could be cool if this package could read jest configuration,
then if testEnvironment == node , use Request and Response polyfills/mocks

@kwelch
Copy link

kwelch commented Feb 6, 2017

I was able to get this working with my steps I mentioned in this comment

@jefflau
Copy link
Owner

jefflau commented Mar 21, 2018

Should be working now with isomorphic-fetch. Originally was written for the browser.

@jefflau jefflau closed this as completed Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants