dalcib / expo-ts-example

105 stars 9 forks source link

Jest and Upgrading to 2.90 #7

Open maitriyogin opened 6 years ago

maitriyogin commented 6 years ago

Hi, I just updated expo to the latest 2.90, after running tests I get the following:

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)

This is definitely a problem with expo but was wondering if anyone else has experienced this?

package.json :

"devDependencies": {
    "@types/jest": "^23.1.0",
    "@types/react": "^16.3.17",
    "@types/react-native": "^0.55.19",
    "@types/react-native-vector-icons": "^4.6.1",
    "@types/react-test-renderer": "^16.0.1",
    "@types/expo": "^27.0.6",
    "@types/expo__vector-icons": "^6.2.2",
    "babel-jest": "^23.0.1",
    "jest-expo": "^29.0.0",
    "react-native-scripts": "1.14.0",
    "react-native-typescript-transformer": "1.2.10",
    "react-test-renderer": "16.4.1",
    "ts-jest": "^22.4.6",
    "tslint-config-prettier": "1.13.0",
    "typescript": "^2.9.2"
  },
  "dependencies": {
    "expo": "^29.0.0",
    "react": "16.4.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
    "react-native-vector-icons": "^4.6.0",
    "tslib": "^1.9.2"
  },
maitriyogin commented 6 years ago

To get it to work I had to add the expo@28 version of whatwg-fetch as a dependency to get this to work ....

yarn add whatwg-fetch@1.1.1