Why does Jest
fail with \"Unexpected token *\" on a simple import statement...
Admin@Admin-PC MINGW32 /d/project (master)
$ npm
As it has been said, some modules needs to be transpiled, & some don't. Here is a regex I use that work in a lot of projects
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-(native|universal|navigation)-(.*)|@react-native-community/(.*)|@react-navigation/(.*)|bs-platform|(@[a-zA-Z]+/)?(bs|reason|rescript)-(.*)+)"
]
}
It's working for most common react native thing, & include also a specific package (here bs-platform
) as an example, when isn't captured by previous patterns.