upgrade-support
upgrade-support copied to clipboard
Jest failed all tests after upgrade to 0.63.x
Environment
System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 8.42 GB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.13.0 - /var/folders/d0/lfphhjrj27905pkqyj8rxqkc0000gr/T/yarn--1603850284161-0.8485769005957491/node
Yarn: 1.22.4 - /var/folders/d0/lfphhjrj27905pkqyj8rxqkc0000gr/T/yarn--1603850284161-0.8485769005957491/yarn
npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
Android NDK: 21.1.6352462
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.7/11E801a - /usr/bin/xcodebuild
Languages:
Java: 11.0.4 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: 4.13.0 => 4.13.0
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Upgrading version
0.62.2 -> 0.63.3
Description
Once upgraded 0.63.3 all tests failed with same error
TypeError: Cannot read property 'OS' of undefined
at Object.<anonymous> (node_modules/react-native/Libraries/Components/View/ReactNativeViewViewConfig.js:325:29)
at Object.<anonymous> (node_modules/react-native/Libraries/Utilities/registerGeneratedViewConfig.js:14:35)
Reproducible demo
yarn jest and all tests failed with the above error
In ReactNativeViewViewConfig, it has the line import {Platform} from 'react-native and this is the reason why the tests failed
I changed it to
const Platform = require('../../Utilities/Platform')
And tests fare working again