79243722

Date: 2024-12-02 10:43:58
Score: 1
Natty:
Report link

I have the same error with jest and custom icon moon

Details:

node_modules/@expo/vector-icons/createIconSetFromIcoMoon.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import createIconSetFromIcoMoon from './build/createIconSetFromIcoMoon';
                                                                                    ^^^^^^

SyntaxError: Cannot use import statement outside a module                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

and I fixed the error following the jest expo docs.

I updated the transformIgnorePatterns on my jest.config.js file

  "transformIgnorePatterns": [
    "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)"
  ]

But now I have another error

● Test suite failed to run

TypeError: Cannot read properties of undefined (reading 'Expo')

    8 |   MaterialIcons,
    9 | } from '@expo/vector-icons';
> 10 | import createIconSetFromIcoMoon from '@expo/vector-icons/createIconSetFromIcoMoon';
Reasons:
  • Whitelisted phrase (-2): I fixed
  • RegEx Blacklisted phrase (1): I have the same error
  • RegEx Blacklisted phrase (1): I have another error
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same error
Posted by: David Leuliette