Test suite failed to run TypeError: Cannot read property 'default' of undefined

This was already answered, but in my case I had a different problem. Apparently react-test-renderer fails to instantiate Components if they are missing their constructor.

So I needed to add them following line to my PureComponent:

constructor(props) {
    super(props)
}

although there's already an accepted answer, I solved it in a different way today.

Following this answer on Github, I put:

sed -i -- 's/inlineRequires: true,/inlineRequires: false,/' node_modules/react-native/jest/preprocessor.js

In my postinstall script. I hope the relevant issue on Github will be solved, but for now, for our team is working like that :-)


My solution was to add the following mock instead:

jest.mock('../app/helpers/bugSnag', () => {
    return {
        leaveBreadcrumb: jest.fn(),
    };
});

A clear explanation to all this would be helpful.