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';