Hello, I am using expo-apple-authentication in our RN bare project and it is working fine. I am trying to run tests on the code and we are using jest and react-native-testing-library. I am getting following error when I try to run the test.
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/xxx/node_modules/@unimodules/core/build/index.js:1
export * from './AdapterProxy';
^^^^^^
SyntaxError: Unexpected token 'export'
at compileFunction (<anonymous>)
at Runtime._execModule (node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (node_modules/expo-apple-authentication/src/AppleAuthentication.ts:1:1)
I added expo-apple-authentication
into transformIgnorePatterns
but this issue is still showing. Do I need to use jest-expo
to test this? I don’t have any expo features in my project except this Apple Authentication … Thanks!