Please provide the following:
- SDK Version: 47
- Platforms(Android/iOS/web/all): All
“jest”: “26.6.3”,
“jest-expo”: “^47.0.1”,
I’m getting the following error when running jest tests in my expo project:
SyntaxError: Cannot use import statement outside a module
The error points to the expo-localization
library in node_modules
:
/node_modules/axios/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import ExpoLocalization from './ExpoLocalization';
In the file under test, I’m importing expo-localization
:
import * as Localization from 'expo-localization';
Here is my simple jest.config.js
file:
module.exports = {
preset: 'jest-expo',
setupFilesAfterEnv: ["<rootDir>/setup-jest.ts"]
}
How can I get jest
to play along with expo-localization
?