mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 17:45:59 +00:00
30152ff5b4
Summary: See https://github.com/facebook/jest/pull/2170. Per cpojer's request, bringing this PR to react-native as well. **Summary** When using jest with React Native and Relay and recommended default settings, jest throws : ``` Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js' at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17) at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18) at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63) ``` Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up `relayUnstableBatchedUpdates.native.js` in react-relay. **Test plan** I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my `package.json` `jest` section, as well a Closes https://github.com/facebook/react-native/pull/11179 Differential Revision: D4243073 Pulled By: cpojer fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
25 lines
695 B
JSON
25 lines
695 B
JSON
{
|
|
"haste": {
|
|
"defaultPlatform": "ios",
|
|
"platforms": ["android", "ios", "native"],
|
|
"providesModuleNodeModules": [
|
|
"react-native"
|
|
]
|
|
},
|
|
"moduleNameMapper": {
|
|
"^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|png|psd|svg|webp)$": "RelativeImageStub",
|
|
"^React$": "<rootDir>node_modules/react"
|
|
},
|
|
"modulePathIgnorePatterns": [
|
|
"<rootDir>/node_modules/react-native/Libraries/react-native/",
|
|
"<rootDir>/node_modules/react-native/packager/"
|
|
],
|
|
"transformIgnorePatterns": [
|
|
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element)"
|
|
],
|
|
"setupFiles": [
|
|
"<rootDir>/node_modules/react-native/jest/setup.js"
|
|
],
|
|
"testEnvironment": "node"
|
|
}
|