benawad / expo-mixpanel-analytics

Mixpanel integration for use with React Native apps built on Expo.
27 stars 33 forks source link

[while running Jest tests] ReferenceError: fetch is not defined #4

Open ghost opened 4 years ago

ghost commented 4 years ago

I'm using this package in my Expo/React Native app and when I try to run my front-end unit tests, the Jest runner fails before it even gets to my actual tests.

The runner is saying that fetch is undefined in the ._pushEvent method.

return fetch(MIXPANEL_API_URL + "/track/?data=" + buffer);

I'm able to resolve this by importing another package (import fetch from 'jest-fetch-mock') into each of my test files. But I was wondering if there was a way that this could be resolved within your package itself?

If it's something that I could help out with by doing a PR, I'd be happy to do so. :-)

Please let me know if you have any questions. Thanks!

benawad commented 4 years ago

I'm not using this package anymore, but PRs are welcome

SirPhemmiey commented 4 years ago

Hi @benawad , what package are you using now for expo mixpanel?