mardi 11 août 2020

Invalid or unexpected token, testing bare react native app

I am practicing test driven development in bare react native and using package jest and enzyme. I installed NativeBase for UI components. and I am getting error when I am using icons from NativeBase

FAIL  src/screens/Welcome/Welcome.test.js
● Test suite failed to run

/Users/../node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/AntDesign.ttf:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){
                                                                                         

SyntaxError: Invalid or unexpected token

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1258:14)
  at Object.<anonymous> (node_modules/@expo/vector-icons/src/AntDesign.ts:2:1)

I have following setting in my package.json file:

"jest": {
  "preset": "react-native",
  "testEnvironment": "jsdom",
  "setupFiles": [
    "./setup.js",
    "./node_modules/react-native-gesture-handler/jestSetup.js"
  ],
  "transformIgnorePatterns": [
    "/!node_modules\\/@expo"
  ]
},

Aucun commentaire:

Enregistrer un commentaire