Since this is the first search result, I wanted to drop another hint for those who are running into this issue with react-native-web and Jest.
As detailed in https://github.com/facebookincubator/create-react-app/issues/1085, if you are mapping 'react-native'
to 'react-native-web'
in your build system (webpack, for me), then you also need that mapping in your Jest config.
I was seeing the
ReferenceError: __DEV__ is not defined
when I ran tests through Jest. Adding
moduleNameMapper: {
'^react-native$': 'react-native-web',
}
to jest.config.js
fixed this for me.