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

changes on dependencies, to fix jest reference error #6

Closed
wants to merge 1 commit into from
Closed

changes on dependencies, to fix jest reference error #6

wants to merge 1 commit into from

Conversation

alexjorgef
Copy link

I have a fresh boilerplate and i'm getting "ReferenceError: self is not defined" running node node_modules/jest/bin/jest.js (yarn jest)

To reproduce:

  1. git clone -b RN git@github.com:GeekyAnts/react-native-boilerplate-redux-flow.git
  2. cd react-native-boilerplate-redux-flow
  3. yarn install
  4. yarn jest

Actual result:

FAIL  ............
  ● Test suite failed to run

    ReferenceError: self is not defined

      at node_modules/whatwg-fetch/dist/fetch.umd.js:8:40
      at Object.<anonymous>.support.searchParams (node_modules/whatwg-fetch/dist/fetch.umd.js:2:66)
      at Object.<anonymous> (node_modules/whatwg-fetch/dist/fetch.umd.js:5:2)
      at Object.<anonymous> (node_modules/jest-expo/src/setup.js:7:47)

Expected result:

Tests pass.

Solution:

The problem is because module expo (or jest-expo?) uses isomorphic-fetch, and maybe this boilerplate was created by expo init wich uses a older version of whatwg-fetch.

A workaround is to add whatwg-fetch version 2.0.4 to our package.json

rm -rf node_modules
npm i whatwg-fetch@2.0.4 --save
npm install

Versions

  • npm: 3.5.2
  • yarn: 1.10.1
  • node: 8.10.0
  • OS: Ubuntu 18.04 (Bionic)

@alexjorgef
Copy link
Author

alexjorgef commented Sep 27, 2018

Issue #7

@alexjorgef alexjorgef closed this Jul 20, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants