As stated in the title, I've recently switched our project from app.json to app.config.json ready for EAS builds in Expo. Since then, my simple App.test.js has been failing
TypeError: Cannot read property 'environment' of undefined
const enableInExpoDevelopment = Constants.manifest.extra.environment !== 'Development'
This is the App.test.js
import React from 'react';
import renderer from 'react-test-renderer';
import App from '../App';
describe('<App />', () => {
it('has 1 child', () => {
const tree = renderer.create(<App />).toJSON();
expect(tree.children.length).toBe(1);
});
});
And this is the current jest.config.js
module.exports = {
preset: 'jest-expo',
transform: {
'^.+\\.js$': require.resolve('react-native/jest/preprocessor.js')
},
transformIgnorePatterns: [
'node_modules/(?!(jest-)?react-native|react-clone-referenced-
element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-
navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-
expo|native-base|@sentry/.*)'
],
reporters: [
'default'
],
setupFiles: [
'./__mocks__/@react-native-async-storage/async-storage.js'
]
}