Jest tests are failing after upgrading to SDK 25


#1

My Jest tests are failing after upgrading to SDK 25. I’m getting SyntaxError: Invalid or unexpected token in /@expo/vector-icons/fonts/Ionicons.ttf:1.
Tried adding "node_modules/@expo/vector-icons/fonts" to my transformIgnorePatterns but with no luck. Any ideas?

This is my my jest configuration

  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|react-native-gesture-handler|native-base|react-navigation)/"
    ],
    "verbose": false,
    "testMatch": ["**/__tests__/**/?(*.)(spec|test).js?(x)"],
    "setupTestFrameworkScriptFile": "./__tests__/setup.js",
    "testPathIgnorePatterns": ["/node_modules/"],
    "globals": {
      "__DEV__": true
    }
  },

#2

hi there. for some reason jest seems to be reading the ttf file and treating it like a js file. you may want to inquire on the jest issues about this!


#3

You can try to update your jest-expo version as mentioned here, but it didn’t solve the issue for me.


#4

It was resolved for me after upgrading to jest-expo 25.1.0


closed #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.