@office-iss/react-native-win32 0.71.4 → 0.72.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/.flowconfig +15 -3
  2. package/CHANGELOG.json +310 -40
  3. package/CHANGELOG.md +145 -23
  4. package/IntegrationTests/IntegrationTestHarnessTest.js +1 -0
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
  6. package/Libraries/Alert/Alert.d.ts +4 -4
  7. package/Libraries/Alert/Alert.win32.js +1 -0
  8. package/Libraries/Animated/Animated.d.ts +17 -6
  9. package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
  10. package/Libraries/Animated/NativeAnimatedHelper.win32.js +606 -0
  11. package/Libraries/Animated/bezier.js +1 -1
  12. package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
  13. package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
  14. package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
  15. package/Libraries/Animated/createAnimatedComponent.js +26 -239
  16. package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
  17. package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
  18. package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
  19. package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
  20. package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
  21. package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
  23. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
  24. package/Libraries/Animated/useAnimatedProps.js +7 -10
  25. package/Libraries/BatchedBridge/MessageQueue.js +2 -1
  26. package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
  27. package/Libraries/BatchedBridge/NativeModules.js +1 -0
  28. package/Libraries/Blob/Blob.js +4 -0
  29. package/Libraries/Blob/FileReader.js +30 -2
  30. package/Libraries/Blob/URL.js +3 -1
  31. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
  32. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -3
  34. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
  35. package/Libraries/Components/Button.js +3 -2
  36. package/Libraries/Components/Button.win32.js +451 -0
  37. package/Libraries/Components/Clipboard/Clipboard.js +1 -1
  38. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  39. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
  40. package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
  41. package/Libraries/Components/Pressable/Pressable.js +1 -1
  42. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
  43. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
  44. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -2
  45. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
  46. package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
  47. package/Libraries/Components/ScrollView/ScrollView.js +149 -91
  48. package/Libraries/Components/ScrollView/ScrollView.win32.js +1939 -0
  49. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
  50. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
  51. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
  52. package/Libraries/Components/StatusBar/StatusBar.js +3 -0
  53. package/Libraries/Components/Switch/Switch.js +3 -1
  54. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
  55. package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
  57. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +51 -0
  58. package/Libraries/Components/TextInput/TextInput.Types.win32.js +3 -0
  59. package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +1 -0
  60. package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
  61. package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
  62. package/Libraries/Components/TextInput/TextInput.js +130 -103
  63. package/Libraries/Components/TextInput/TextInput.win32.js +202 -890
  64. package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
  65. package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
  66. package/Libraries/Components/Touchable/Touchable.js +6 -3
  67. package/Libraries/Components/Touchable/Touchable.win32.js +6 -3
  68. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
  72. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  73. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +189 -0
  74. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
  75. package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
  76. package/Libraries/Components/View/View.js +71 -45
  77. package/Libraries/Components/View/View.win32.js +38 -16
  78. package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
  79. package/Libraries/Components/View/ViewAccessibility.js +10 -1
  80. package/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  81. package/Libraries/Components/View/ViewNativeComponent.js +32 -8
  82. package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
  83. package/Libraries/Components/View/ViewPropTypes.js +1 -1
  84. package/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  85. package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
  86. package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
  87. package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
  88. package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
  89. package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
  90. package/Libraries/Core/ExceptionsManager.js +2 -2
  91. package/Libraries/Core/InitializeCore.js +2 -1
  92. package/Libraries/Core/ReactNativeVersion.js +3 -3
  93. package/Libraries/Core/ReactNativeVersionCheck.js +1 -9
  94. package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -9
  95. package/Libraries/Core/Timers/JSTimers.js +1 -1
  96. package/Libraries/Core/Timers/immediateShim.js +1 -0
  97. package/Libraries/Core/Timers/queueMicrotask.js +1 -1
  98. package/Libraries/Core/setUpAlert.js +1 -1
  99. package/Libraries/Core/setUpDOM.js +18 -0
  100. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  101. package/Libraries/Core/setUpGlobals.js +5 -2
  102. package/Libraries/Core/setUpNavigator.js +6 -5
  103. package/Libraries/Core/setUpPerformance.js +23 -13
  104. package/Libraries/Core/setUpReactDevTools.js +2 -0
  105. package/Libraries/Core/setUpSegmentFetcher.js +0 -41
  106. package/Libraries/Core/setUpTimers.js +2 -2
  107. package/Libraries/DOM/Geometry/DOMRect.js +82 -0
  108. package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
  109. package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
  110. package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
  111. package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
  112. package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
  113. package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
  114. package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
  115. package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
  116. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
  117. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
  118. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
  119. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +35 -0
  120. package/Libraries/{Utilities/NativeDevSplitBundleLoader.js → DevToolsSettings/NativeDevToolsSettingsManager.js} +7 -2
  121. package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
  122. package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
  123. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
  124. package/Libraries/Events/EventPolyfill.js +1 -1
  125. package/Libraries/Image/AssetRegistry.js +1 -1
  126. package/Libraries/Image/AssetSourceResolver.js +3 -3
  127. package/Libraries/Image/Image.android.js +4 -1
  128. package/Libraries/Image/Image.d.ts +63 -2
  129. package/Libraries/Image/Image.ios.js +3 -0
  130. package/Libraries/Image/Image.win32.js +3 -0
  131. package/Libraries/Image/ImageBackground.js +1 -0
  132. package/Libraries/Image/ImageProps.js +1 -1
  133. package/Libraries/Image/ImageViewNativeComponent.js +4 -4
  134. package/Libraries/Image/RelativeImageStub.js +1 -1
  135. package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
  136. package/Libraries/Image/resolveAssetSource.js +1 -1
  137. package/Libraries/Inspector/DevtoolsOverlay.js +29 -19
  138. package/Libraries/Inspector/ElementBox.js +4 -1
  139. package/Libraries/Inspector/Inspector.js +5 -6
  140. package/Libraries/Inspector/Inspector.win32.js +7 -6
  141. package/Libraries/Inspector/InspectorOverlay.js +3 -3
  142. package/Libraries/Inspector/InspectorOverlay.win32.js +2 -1
  143. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  144. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
  145. package/Libraries/Interaction/PanResponder.js +5 -6
  146. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
  147. package/Libraries/Linking/Linking.js +1 -4
  148. package/Libraries/Lists/FillRateHelper.js +4 -238
  149. package/Libraries/Lists/FlatList.d.ts +15 -22
  150. package/Libraries/Lists/FlatList.js +9 -6
  151. package/Libraries/Lists/SectionList.d.ts +10 -6
  152. package/Libraries/Lists/SectionList.js +5 -3
  153. package/Libraries/Lists/SectionListModern.js +3 -3
  154. package/Libraries/Lists/ViewabilityHelper.js +8 -344
  155. package/Libraries/Lists/VirtualizeUtils.js +4 -244
  156. package/Libraries/Lists/VirtualizedList.js +10 -1867
  157. package/Libraries/Lists/VirtualizedListContext.js +6 -104
  158. package/Libraries/Lists/VirtualizedSectionList.js +9 -602
  159. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
  160. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  161. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  162. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  163. package/Libraries/LogBox/LogBox.js +1 -1
  164. package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
  165. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
  166. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +3 -0
  167. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +193 -0
  168. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
  169. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
  170. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +7 -3
  171. package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
  172. package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
  173. package/Libraries/Modal/Modal.js +2 -2
  174. package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
  175. package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
  176. package/Libraries/NativeComponent/BaseViewConfig.win32.js +43 -19
  177. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
  178. package/Libraries/NativeComponent/ViewConfig.js +1 -0
  179. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
  180. package/Libraries/Network/RCTNetworking.android.js +2 -2
  181. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  182. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  183. package/Libraries/Network/XMLHttpRequest.js +1 -1
  184. package/Libraries/Pressability/Pressability.js +11 -5
  185. package/Libraries/Pressability/Pressability.win32.js +9 -3
  186. package/Libraries/ReactNative/AppContainer.js +7 -1
  187. package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
  188. package/Libraries/ReactNative/AppRegistry.js +10 -13
  189. package/Libraries/ReactNative/FabricUIManager.js +24 -8
  190. package/Libraries/ReactNative/NativeUIManager.js +5 -5
  191. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
  192. package/Libraries/ReactNative/UIManager.js +142 -1
  193. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
  194. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  195. package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
  196. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  197. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
  198. package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
  199. package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
  200. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
  201. package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
  202. package/Libraries/Renderer/shims/ReactNativeTypes.js +38 -20
  203. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
  204. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  205. package/Libraries/Share/Share.js +1 -1
  206. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  207. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  208. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  209. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
  210. package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
  211. package/Libraries/StyleSheet/flattenStyle.js +2 -0
  212. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  213. package/Libraries/StyleSheet/processColor.js +1 -1
  214. package/Libraries/Text/Text.d.ts +12 -2
  215. package/Libraries/Text/Text.js +50 -41
  216. package/Libraries/Text/TextProps.js +3 -4
  217. package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
  218. package/Libraries/Types/CodegenTypes.js +1 -0
  219. package/Libraries/UTFSequence.js +3 -1
  220. package/Libraries/Utilities/Appearance.d.ts +10 -0
  221. package/Libraries/Utilities/Appearance.js +13 -0
  222. package/Libraries/Utilities/Dimensions.js +1 -1
  223. package/Libraries/Utilities/Dimensions.win32.js +1 -1
  224. package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
  225. package/Libraries/Utilities/HMRClient.js +16 -10
  226. package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
  227. package/Libraries/Utilities/IPerformanceLogger.js +49 -0
  228. package/Libraries/Utilities/LoadingView.android.js +28 -11
  229. package/Libraries/Utilities/NativeAppearance.js +1 -0
  230. package/Libraries/Utilities/NativePlatformConstantsWin.js +1 -1
  231. package/Libraries/Utilities/PixelRatio.js +2 -2
  232. package/Libraries/Utilities/Platform.win32.js +1 -1
  233. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  234. package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
  235. package/Libraries/Utilities/codegenNativeCommands.js +2 -0
  236. package/Libraries/Utilities/createPerformanceLogger.js +55 -43
  237. package/Libraries/Utilities/stringifySafe.js +2 -7
  238. package/Libraries/Utilities/useColorScheme.js +1 -1
  239. package/Libraries/Utilities/useWindowDimensions.js +3 -3
  240. package/Libraries/WebPerformance/EventCounts.js +78 -0
  241. package/Libraries/WebPerformance/MemoryInfo.js +54 -0
  242. package/Libraries/WebPerformance/NativePerformance.js +38 -0
  243. package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
  244. package/Libraries/WebPerformance/Performance.js +312 -0
  245. package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
  246. package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
  247. package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
  248. package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
  249. package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
  250. package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
  251. package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
  252. package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
  253. package/Libraries/vendor/core/ErrorUtils.js +1 -1
  254. package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
  255. package/Libraries/vendor/emitter/EventEmitter.js +9 -1
  256. package/flow/global.js +29 -4
  257. package/flow/jest.js +258 -164
  258. package/index.js +56 -42
  259. package/index.win32.js +56 -42
  260. package/interface.js +1 -1
  261. package/jest/local-setup.js +33 -0
  262. package/jest/mockComponent.js +4 -2
  263. package/jest/mockNativeComponent.js +1 -1
  264. package/jest/mockScrollView.js +2 -1
  265. package/jest/react-native-env.js +1 -3
  266. package/jest/setup.js +11 -8
  267. package/overrides.json +115 -85
  268. package/package.json +38 -28
  269. package/rn-get-polyfills.js +1 -1
  270. package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +68 -0
  271. package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  272. package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  273. package/types/index.d.ts +2 -6
  274. package/types/modules/Codegen.d.ts +4 -4
  275. package/types/modules/globals.d.ts +27 -25
  276. package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
  277. package/types/public/ReactNativeRenderer.d.ts +2 -7
  278. package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
  279. package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
  280. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
  281. package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
  282. package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
  283. package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
  284. package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
  285. package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
  286. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
  287. package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -47
  288. package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
  289. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
  290. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
  291. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
  292. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
  293. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -45
  294. package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
  295. package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
  296. package/Libraries/Components/Slider/Slider.d.ts +0 -132
  297. package/Libraries/Components/Slider/Slider.js +0 -282
  298. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
  299. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +0 -23
  300. package/Libraries/Interaction/Batchinator.js +0 -76
  301. package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
  302. package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
  303. package/Libraries/Interaction/PanResponder.flow.js +0 -257
  304. package/Libraries/Lists/CellRenderMask.js +0 -155
  305. package/Libraries/Lists/ChildListCollection.js +0 -72
  306. package/Libraries/Lists/StateSafePureComponent.js +0 -85
  307. package/Libraries/Lists/VirtualizedList.d.ts +0 -347
  308. package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
  309. package/Libraries/Lists/VirtualizedListProps.js +0 -279
  310. package/Libraries/Performance/PureComponentDebug.js +0 -74
  311. package/Libraries/Reliability/UserFlow.js +0 -158
  312. package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
  313. package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
  314. package/Libraries/Utilities/MatrixMath.js +0 -748
  315. package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
  316. package/Libraries/Utilities/clamp.js +0 -23
  317. package/Libraries/Utilities/deprecatedPropType.js +0 -36
  318. package/Libraries/Utilities/groupByEveryN.js +0 -51
  319. package/Libraries/Utilities/mergeIntoFast.js +0 -26
  320. package/Libraries/Utilities/setAndForwardRef.js +0 -71
  321. package/Libraries/Utilities/truncate.js +0 -51
  322. package/flow/JSITimerInternalType.js +0 -30
  323. package/flow/use-sync-external-store.js +0 -19
package/flow/jest.js CHANGED
@@ -4,18 +4,18 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
+ * @flow
7
8
  * @format
9
+ * @oncall react_native
8
10
  */
9
11
 
10
- // Modified from https://raw.githubusercontent.com/flow-typed/flow-typed/master/definitions/npm/jest_v23.x.x/flow_v0.39.x-v0.103.x/jest_v23.x.x.js
11
- // List of modifications:
12
- // - fix some [] -> Array lint warnings
13
- // - make it.each/describe.each take $ReadOnlyArray instead of Array<mixed>
14
- // - added definition for `isolateModules`
15
- //
16
- // TODO(T35016336) remove the .each modifications if flow-typed adopts them
12
+ // Modified from https://raw.githubusercontent.com/flow-typed/flow-typed/master/definitions/npm/jest_v29.x.x/flow_v0.134.x-/jest_v29.x.x.js
13
+ // Modifications are explained inline by comments beginning with `// MODIFIED`.
17
14
 
18
- type JestMockFn<TArguments: $ReadOnlyArray<mixed>, TReturn> = {|
15
+ // MODIFIED: Added ESLint suppression comment - no-unused-vars doesn't understand declaration files
16
+ /* eslint-disable no-unused-vars */
17
+
18
+ type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
19
19
  (...args: TArguments): TReturn,
20
20
  /**
21
21
  * An object for introspecting mock calls
@@ -27,6 +27,12 @@ type JestMockFn<TArguments: $ReadOnlyArray<mixed>, TReturn> = {|
27
27
  * passed during the call.
28
28
  */
29
29
  calls: Array<TArguments>,
30
+ /**
31
+ * An array containing the call arguments of the last call that was made
32
+ * to this mock function. If the function was not called, it will return
33
+ * undefined.
34
+ */
35
+ lastCall: TArguments,
30
36
  /**
31
37
  * An array that contains all the object instances that have been
32
38
  * instantiated from this mock function.
@@ -36,7 +42,11 @@ type JestMockFn<TArguments: $ReadOnlyArray<mixed>, TReturn> = {|
36
42
  * An array that contains all the object results that have been
37
43
  * returned by this mock function call
38
44
  */
39
- results: Array<{isThrow: boolean, value: TReturn, ...}>,
45
+ results: Array<{
46
+ isThrow: boolean,
47
+ value: TReturn,
48
+ ...
49
+ }>,
40
50
  ...
41
51
  },
42
52
  /**
@@ -110,7 +120,8 @@ type JestMockFn<TArguments: $ReadOnlyArray<mixed>, TReturn> = {|
110
120
  * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
111
121
  */
112
122
  mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
113
- |};
123
+ ...
124
+ };
114
125
 
115
126
  type JestAsymmetricEqualityType = {
116
127
  /**
@@ -146,8 +157,8 @@ type JestMatcherResult = {
146
157
  };
147
158
 
148
159
  type JestMatcher = (
149
- actual: any,
150
- expected: any,
160
+ received: any,
161
+ ...actual: Array<any>
151
162
  ) => JestMatcherResult | Promise<JestMatcherResult>;
152
163
 
153
164
  type JestPromiseType = {
@@ -170,6 +181,32 @@ type JestPromiseType = {
170
181
  */
171
182
  type JestTestName = string | Function;
172
183
 
184
+ type FakeableAPI =
185
+ | 'Date'
186
+ | 'hrtime'
187
+ | 'nextTick'
188
+ | 'performance'
189
+ | 'queueMicrotask'
190
+ | 'requestAnimationFrame'
191
+ | 'cancelAnimationFrame'
192
+ | 'requestIdleCallback'
193
+ | 'cancelIdleCallback'
194
+ | 'setImmediate'
195
+ | 'clearImmediate'
196
+ | 'setInterval'
197
+ | 'clearInterval'
198
+ | 'setTimeout'
199
+ | 'clearTimeout';
200
+
201
+ type FakeTimersConfig = {
202
+ advanceTimers?: boolean | number,
203
+ doNotFake?: Array<FakeableAPI>,
204
+ now?: number | Date,
205
+ timerLimit?: number,
206
+ legacyFakeTimers?: boolean,
207
+ ...
208
+ };
209
+
173
210
  /**
174
211
  * Plugin: jest-styled-components
175
212
  */
@@ -200,36 +237,77 @@ type JestStyledComponentsMatchersType = {
200
237
  * Plugin: jest-enzyme
201
238
  */
202
239
  type EnzymeMatchersType = {
240
+ // 5.x
241
+ toBeEmpty(): void,
242
+ toBePresent(): void,
243
+ // 6.x
203
244
  toBeChecked(): void,
204
245
  toBeDisabled(): void,
205
- toBeEmpty(): void,
206
246
  toBeEmptyRender(): void,
207
- toBePresent(): void,
247
+ toContainMatchingElement(selector: string): void,
248
+ toContainMatchingElements(n: number, selector: string): void,
249
+ toContainExactlyOneMatchingElement(selector: string): void,
208
250
  toContainReact(element: React$Element<any>): void,
209
251
  toExist(): void,
210
252
  toHaveClassName(className: string): void,
211
253
  toHaveHTML(html: string): void,
212
254
  toHaveProp: ((propKey: string, propValue?: any) => void) &
213
- ((props: Object) => void),
255
+ ((props: {...}) => void),
214
256
  toHaveRef(refName: string): void,
215
257
  toHaveState: ((stateKey: string, stateValue?: any) => void) &
216
- ((state: Object) => void),
258
+ ((state: {...}) => void),
217
259
  toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
218
- ((style: Object) => void),
260
+ ((style: {...}) => void),
219
261
  toHaveTagName(tagName: string): void,
220
262
  toHaveText(text: string): void,
221
- toIncludeText(text: string): void,
222
263
  toHaveValue(value: any): void,
223
- toMatchElement(element: React$Element<any>): void,
264
+ toIncludeText(text: string): void,
265
+ toMatchElement(
266
+ element: React$Element<any>,
267
+ options?: {|ignoreProps?: boolean, verbose?: boolean|},
268
+ ): void,
224
269
  toMatchSelector(selector: string): void,
270
+ // 7.x
271
+ toHaveDisplayName(name: string): void,
225
272
  ...
226
273
  };
227
274
 
228
- // DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers
275
+ // DOM testing library extensions (jest-dom)
276
+ // https://github.com/testing-library/jest-dom
229
277
  type DomTestingLibraryType = {
230
- toBeInTheDOM(): void,
231
- toHaveTextContent(content: string): void,
232
- toHaveAttribute(name: string, expectedValue?: string): void,
278
+ /**
279
+ * @deprecated
280
+ */
281
+ toBeInTheDOM(container?: HTMLElement): void,
282
+
283
+ // 4.x
284
+ toBeInTheDocument(): void,
285
+ toBeVisible(): void,
286
+ toBeEmpty(): void,
287
+ toBeDisabled(): void,
288
+ toBeEnabled(): void,
289
+ toBeInvalid(): void,
290
+ toBeRequired(): void,
291
+ toBeValid(): void,
292
+ toContainElement(element: HTMLElement | null): void,
293
+ toContainHTML(htmlText: string): void,
294
+ toHaveAttribute(attr: string, value?: any): void,
295
+ toHaveClass(...classNames: string[]): void,
296
+ toHaveFocus(): void,
297
+ toHaveFormValues(expectedValues: {[name: string]: any, ...}): void,
298
+ toHaveStyle(css: string | {[name: string]: any, ...}): void,
299
+ toHaveTextContent(
300
+ text: string | RegExp,
301
+ options?: {|normalizeWhitespace: boolean|},
302
+ ): void,
303
+ toHaveValue(value?: string | string[] | number): void,
304
+
305
+ // 5.x
306
+ toHaveDisplayValue(value: string | string[]): void,
307
+ toBeChecked(): void,
308
+ toBeEmptyDOMElement(): void,
309
+ toBePartiallyChecked(): void,
310
+ toHaveDescription(text: string | RegExp): void,
233
311
  ...
234
312
  };
235
313
 
@@ -282,78 +360,64 @@ type JestExtendedMatchersType = {
282
360
  * Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
283
361
  */
284
362
  toBeEmpty(): void,
285
-
286
363
  /**
287
364
  * Use .toBeOneOf when checking if a value is a member of a given Array.
288
365
  * @param {Array.<*>} members
289
366
  */
290
- toBeOneOf(members: Array<any>): void,
291
-
367
+ toBeOneOf(members: any[]): void,
292
368
  /**
293
369
  * Use `.toBeNil` when checking a value is `null` or `undefined`.
294
370
  */
295
371
  toBeNil(): void,
296
-
297
372
  /**
298
373
  * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
299
374
  * @param {Function} predicate
300
375
  */
301
376
  toSatisfy(predicate: (n: any) => boolean): void,
302
-
303
377
  /**
304
378
  * Use `.toBeArray` when checking if a value is an `Array`.
305
379
  */
306
380
  toBeArray(): void,
307
-
308
381
  /**
309
382
  * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
310
383
  * @param {Number} x
311
384
  */
312
385
  toBeArrayOfSize(x: number): void,
313
-
314
386
  /**
315
387
  * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
316
388
  * @param {Array.<*>} members
317
389
  */
318
- toIncludeAllMembers(members: Array<any>): void,
319
-
390
+ toIncludeAllMembers(members: any[]): void,
320
391
  /**
321
392
  * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
322
393
  * @param {Array.<*>} members
323
394
  */
324
- toIncludeAnyMembers(members: Array<any>): void,
325
-
395
+ toIncludeAnyMembers(members: any[]): void,
326
396
  /**
327
397
  * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
328
398
  * @param {Function} predicate
329
399
  */
330
400
  toSatisfyAll(predicate: (n: any) => boolean): void,
331
-
332
401
  /**
333
402
  * Use `.toBeBoolean` when checking if a value is a `Boolean`.
334
403
  */
335
404
  toBeBoolean(): void,
336
-
337
405
  /**
338
406
  * Use `.toBeTrue` when checking a value is equal (===) to `true`.
339
407
  */
340
408
  toBeTrue(): void,
341
-
342
409
  /**
343
410
  * Use `.toBeFalse` when checking a value is equal (===) to `false`.
344
411
  */
345
412
  toBeFalse(): void,
346
-
347
413
  /**
348
414
  * Use .toBeDate when checking if a value is a Date.
349
415
  */
350
416
  toBeDate(): void,
351
-
352
417
  /**
353
418
  * Use `.toBeFunction` when checking if a value is a `Function`.
354
419
  */
355
420
  toBeFunction(): void,
356
-
357
421
  /**
358
422
  * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
359
423
  *
@@ -363,42 +427,34 @@ type JestExtendedMatchersType = {
363
427
  * @param {Mock} mock
364
428
  */
365
429
  toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
366
-
367
430
  /**
368
431
  * Use `.toBeNumber` when checking if a value is a `Number`.
369
432
  */
370
433
  toBeNumber(): void,
371
-
372
434
  /**
373
435
  * Use `.toBeNaN` when checking a value is `NaN`.
374
436
  */
375
437
  toBeNaN(): void,
376
-
377
438
  /**
378
439
  * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
379
440
  */
380
441
  toBeFinite(): void,
381
-
382
442
  /**
383
443
  * Use `.toBePositive` when checking if a value is a positive `Number`.
384
444
  */
385
445
  toBePositive(): void,
386
-
387
446
  /**
388
447
  * Use `.toBeNegative` when checking if a value is a negative `Number`.
389
448
  */
390
449
  toBeNegative(): void,
391
-
392
450
  /**
393
451
  * Use `.toBeEven` when checking if a value is an even `Number`.
394
452
  */
395
453
  toBeEven(): void,
396
-
397
454
  /**
398
455
  * Use `.toBeOdd` when checking if a value is an odd `Number`.
399
456
  */
400
457
  toBeOdd(): void,
401
-
402
458
  /**
403
459
  * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
404
460
  *
@@ -406,144 +462,122 @@ type JestExtendedMatchersType = {
406
462
  * @param {Number} end
407
463
  */
408
464
  toBeWithin(start: number, end: number): void,
409
-
410
465
  /**
411
466
  * Use `.toBeObject` when checking if a value is an `Object`.
412
467
  */
413
468
  toBeObject(): void,
414
-
415
469
  /**
416
470
  * Use `.toContainKey` when checking if an object contains the provided key.
417
471
  *
418
472
  * @param {String} key
419
473
  */
420
474
  toContainKey(key: string): void,
421
-
422
475
  /**
423
476
  * Use `.toContainKeys` when checking if an object has all of the provided keys.
424
477
  *
425
478
  * @param {Array.<String>} keys
426
479
  */
427
- toContainKeys(keys: Array<string>): void,
428
-
480
+ toContainKeys(keys: string[]): void,
429
481
  /**
430
482
  * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
431
483
  *
432
484
  * @param {Array.<String>} keys
433
485
  */
434
- toContainAllKeys(keys: Array<string>): void,
435
-
486
+ toContainAllKeys(keys: string[]): void,
436
487
  /**
437
488
  * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
438
489
  *
439
490
  * @param {Array.<String>} keys
440
491
  */
441
- toContainAnyKeys(keys: Array<string>): void,
442
-
492
+ toContainAnyKeys(keys: string[]): void,
443
493
  /**
444
494
  * Use `.toContainValue` when checking if an object contains the provided value.
445
495
  *
446
496
  * @param {*} value
447
497
  */
448
498
  toContainValue(value: any): void,
449
-
450
499
  /**
451
500
  * Use `.toContainValues` when checking if an object contains all of the provided values.
452
501
  *
453
502
  * @param {Array.<*>} values
454
503
  */
455
- toContainValues(values: Array<any>): void,
456
-
504
+ toContainValues(values: any[]): void,
457
505
  /**
458
506
  * Use `.toContainAllValues` when checking if an object only contains all of the provided values.
459
507
  *
460
508
  * @param {Array.<*>} values
461
509
  */
462
- toContainAllValues(values: Array<any>): void,
463
-
510
+ toContainAllValues(values: any[]): void,
464
511
  /**
465
512
  * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
466
513
  *
467
514
  * @param {Array.<*>} values
468
515
  */
469
- toContainAnyValues(values: Array<any>): void,
470
-
516
+ toContainAnyValues(values: any[]): void,
471
517
  /**
472
518
  * Use `.toContainEntry` when checking if an object contains the provided entry.
473
519
  *
474
520
  * @param {Array.<String, String>} entry
475
521
  */
476
522
  toContainEntry(entry: [string, string]): void,
477
-
478
523
  /**
479
524
  * Use `.toContainEntries` when checking if an object contains all of the provided entries.
480
525
  *
481
526
  * @param {Array.<Array.<String, String>>} entries
482
527
  */
483
- toContainEntries(entries: Array<[string, string]>): void,
484
-
528
+ toContainEntries(entries: [string, string][]): void,
485
529
  /**
486
530
  * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
487
531
  *
488
532
  * @param {Array.<Array.<String, String>>} entries
489
533
  */
490
- toContainAllEntries(entries: Array<[string, string]>): void,
491
-
534
+ toContainAllEntries(entries: [string, string][]): void,
492
535
  /**
493
536
  * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
494
537
  *
495
538
  * @param {Array.<Array.<String, String>>} entries
496
539
  */
497
- toContainAnyEntries(entries: Array<[string, string]>): void,
498
-
540
+ toContainAnyEntries(entries: [string, string][]): void,
499
541
  /**
500
542
  * Use `.toBeExtensible` when checking if an object is extensible.
501
543
  */
502
544
  toBeExtensible(): void,
503
-
504
545
  /**
505
546
  * Use `.toBeFrozen` when checking if an object is frozen.
506
547
  */
507
548
  toBeFrozen(): void,
508
-
509
549
  /**
510
550
  * Use `.toBeSealed` when checking if an object is sealed.
511
551
  */
512
552
  toBeSealed(): void,
513
-
514
553
  /**
515
554
  * Use `.toBeString` when checking if a value is a `String`.
516
555
  */
517
556
  toBeString(): void,
518
-
519
557
  /**
520
558
  * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
521
559
  *
522
560
  * @param {String} string
523
561
  */
524
562
  toEqualCaseInsensitive(string: string): void,
525
-
526
563
  /**
527
564
  * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
528
565
  *
529
566
  * @param {String} prefix
530
567
  */
531
568
  toStartWith(prefix: string): void,
532
-
533
569
  /**
534
570
  * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
535
571
  *
536
572
  * @param {String} suffix
537
573
  */
538
574
  toEndWith(suffix: string): void,
539
-
540
575
  /**
541
576
  * Use `.toInclude` when checking if a `String` includes the given `String` substring.
542
577
  *
543
578
  * @param {String} substring
544
579
  */
545
580
  toInclude(substring: string): void,
546
-
547
581
  /**
548
582
  * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
549
583
  *
@@ -551,13 +585,34 @@ type JestExtendedMatchersType = {
551
585
  * @param {Number} times
552
586
  */
553
587
  toIncludeRepeated(substring: string, times: number): void,
554
-
555
588
  /**
556
589
  * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
557
590
  *
558
591
  * @param {Array.<String>} substring
559
592
  */
560
- toIncludeMultiple(substring: Array<string>): void,
593
+ toIncludeMultiple(substring: string[]): void,
594
+ ...
595
+ };
596
+
597
+ // Diffing snapshot utility for Jest (snapshot-diff)
598
+ // https://github.com/jest-community/snapshot-diff
599
+ type SnapshotDiffType = {
600
+ /**
601
+ * Compare the difference between the actual in the `expect()`
602
+ * vs the object inside `valueB` with some extra options.
603
+ */
604
+ toMatchDiffSnapshot(
605
+ valueB: any,
606
+ options?: {|
607
+ expand?: boolean,
608
+ colors?: boolean,
609
+ contextLines?: number,
610
+ stablePatchmarks?: boolean,
611
+ aAnnotation?: string,
612
+ bAnnotation?: string,
613
+ |},
614
+ testName?: string,
615
+ ): void,
561
616
  ...
562
617
  };
563
618
 
@@ -567,7 +622,8 @@ interface JestExpectType {
567
622
  DomTestingLibraryType &
568
623
  JestJQueryMatchersType &
569
624
  JestStyledComponentsMatchersType &
570
- JestExtendedMatchersType;
625
+ JestExtendedMatchersType &
626
+ SnapshotDiffType;
571
627
  /**
572
628
  * If you have a mock function, you can use .lastCalledWith to test what
573
629
  * arguments it was last called with.
@@ -710,7 +766,7 @@ interface JestExpectType {
710
766
  /**
711
767
  *
712
768
  */
713
- toHaveProperty(propPath: string, value?: any): void;
769
+ toHaveProperty(propPath: string | $ReadOnlyArray<string>, value?: any): void;
714
770
  /**
715
771
  * Use .toMatch to check that a string matches a regular expression or string.
716
772
  */
@@ -726,20 +782,14 @@ interface JestExpectType {
726
782
  /**
727
783
  * This ensures that an Object matches the most recent snapshot.
728
784
  */
729
- toMatchSnapshot(
730
- propertyMatchers?: {[key: string]: JestAsymmetricEqualityType, ...},
731
- name?: string,
732
- ): void;
785
+ toMatchSnapshot(propertyMatchers?: any, name?: string): void;
733
786
  /**
734
787
  * This ensures that an Object matches the most recent snapshot.
735
788
  */
736
789
  toMatchSnapshot(name: string): void;
737
790
 
738
791
  toMatchInlineSnapshot(snapshot?: string): void;
739
- toMatchInlineSnapshot(
740
- propertyMatchers?: {[key: string]: JestAsymmetricEqualityType, ...},
741
- snapshot?: string,
742
- ): void;
792
+ toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void;
743
793
  /**
744
794
  * Use .toThrow to test that a function throws when it is called.
745
795
  * If you want to test that a specific error gets thrown, you can provide an
@@ -796,6 +846,18 @@ type JestObjectType = {
796
846
  * Removes any pending timers from the timer system.
797
847
  */
798
848
  clearAllTimers(): void,
849
+ /**
850
+ * Returns the number of fake timers still left to run.
851
+ */
852
+ getTimerCount(): number,
853
+ /**
854
+ * Set the current system time used by fake timers.
855
+ * Simulates a user changing the system clock while your program is running.
856
+ * It affects the current time but it does not in itself cause
857
+ * e.g. timers to fire; they will fire exactly as they would have done
858
+ * without the call to jest.setSystemTime().
859
+ */
860
+ setSystemTime(now?: number | Date): void,
799
861
  /**
800
862
  * The same as `mock` but not moved to the top of the expectation by
801
863
  * babel-jest.
@@ -810,6 +872,7 @@ type JestObjectType = {
810
872
  * Returns a new, unused mock function. Optionally takes a mock
811
873
  * implementation.
812
874
  */
875
+ // MODIFIED: Added defaults to type arguments.
813
876
  fn<TArguments: $ReadOnlyArray<mixed> = $ReadOnlyArray<any>, TReturn = any>(
814
877
  implementation?: (...args: TArguments) => TReturn,
815
878
  ): JestMockFn<TArguments, TReturn>,
@@ -817,11 +880,15 @@ type JestObjectType = {
817
880
  * Determines if the given function is a mocked function.
818
881
  */
819
882
  isMockFunction(fn: Function): boolean,
883
+ /**
884
+ * Alias of `createMockFromModule`.
885
+ */
886
+ genMockFromModule(moduleName: string): any,
820
887
  /**
821
888
  * Given the name of a module, use the automatic mocking system to generate a
822
889
  * mocked version of the module for you.
823
890
  */
824
- genMockFromModule(moduleName: string): any,
891
+ createMockFromModule(moduleName: string): any,
825
892
  /**
826
893
  * Mocks a module with an auto-mocked version when it is being required.
827
894
  *
@@ -851,6 +918,12 @@ type JestObjectType = {
851
918
  * useful to isolate modules where local state might conflict between tests.
852
919
  */
853
920
  resetModules(): JestObjectType,
921
+ /**
922
+ * Creates a sandbox registry for the modules that are loaded inside the
923
+ * callback function. This is useful to isolate specific modules for every
924
+ * test so that local module state doesn't conflict between tests.
925
+ */
926
+ isolateModules(fn: () => void): JestObjectType,
854
927
  /**
855
928
  * Exhausts the micro-task queue (usually interfaced in node via
856
929
  * process.nextTick).
@@ -870,13 +943,6 @@ type JestObjectType = {
870
943
  * or setInterval() and setImmediate()).
871
944
  */
872
945
  advanceTimersByTime(msToRun: number): void,
873
- /**
874
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
875
- * or setInterval() and setImmediate()).
876
- *
877
- * Renamed to `advanceTimersByTime`.
878
- */
879
- runTimersToTime(msToRun: number): void,
880
946
  /**
881
947
  * Executes only the macro-tasks that are currently pending (i.e., only the
882
948
  * tasks that have been queued by setTimeout() or setInterval() up to this
@@ -900,7 +966,7 @@ type JestObjectType = {
900
966
  * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
901
967
  * setImmediate and clearImmediate).
902
968
  */
903
- useFakeTimers(type?: 'legacy' | 'modern'): JestObjectType,
969
+ useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType,
904
970
  /**
905
971
  * Instructs Jest to use the real versions of the standard timer functions.
906
972
  */
@@ -922,29 +988,31 @@ type JestObjectType = {
922
988
  ...
923
989
  };
924
990
 
925
- type JestSpyType = {
926
- calls: JestCallsType,
927
- ...
928
- };
991
+ type JestSpyType = {calls: JestCallsType, ...};
992
+
993
+ type JestDoneFn = {|
994
+ (error?: Error): void,
995
+ fail: (error: Error) => void,
996
+ |};
929
997
 
930
998
  /** Runs this function after every test inside this context */
931
999
  declare function afterEach(
932
- fn: (done: () => void) => ?Promise<mixed>,
1000
+ fn: (done: JestDoneFn) => ?Promise<mixed>,
933
1001
  timeout?: number,
934
1002
  ): void;
935
1003
  /** Runs this function before every test inside this context */
936
1004
  declare function beforeEach(
937
- fn: (done: () => void) => ?Promise<mixed>,
1005
+ fn: (done: JestDoneFn) => ?Promise<mixed>,
938
1006
  timeout?: number,
939
1007
  ): void;
940
1008
  /** Runs this function after all tests have finished inside this context */
941
1009
  declare function afterAll(
942
- fn: (done: () => void) => ?Promise<mixed>,
1010
+ fn: (done: JestDoneFn) => ?Promise<mixed>,
943
1011
  timeout?: number,
944
1012
  ): void;
945
1013
  /** Runs this function before any tests have started inside this context */
946
1014
  declare function beforeAll(
947
- fn: (done: () => void) => ?Promise<mixed>,
1015
+ fn: (done: JestDoneFn) => ?Promise<mixed>,
948
1016
  timeout?: number,
949
1017
  ): void;
950
1018
 
@@ -954,27 +1022,25 @@ declare var describe: {
954
1022
  * Creates a block that groups together several related tests in one "test suite"
955
1023
  */
956
1024
  (name: JestTestName, fn: () => void): void,
957
-
958
1025
  /**
959
1026
  * Only run this describe block
960
1027
  */
961
1028
  only(name: JestTestName, fn: () => void): void,
962
-
963
1029
  /**
964
1030
  * Skip running this describe block
965
1031
  */
966
1032
  skip(name: JestTestName, fn: () => void): void,
967
-
968
1033
  /**
969
1034
  * each runs this test against array of argument arrays per each run
970
1035
  *
971
1036
  * @param {table} table of Test
972
1037
  */
973
- each<TArguments: Array<mixed> | mixed>(
974
- table: $ReadOnlyArray<TArguments>,
1038
+ each(
1039
+ ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
975
1040
  ): (
976
1041
  name: JestTestName,
977
- fn?: (...args: TArguments) => ?Promise<mixed>,
1042
+ fn?: (...args: Array<any>) => ?Promise<mixed>,
1043
+ timeout?: number,
978
1044
  ) => void,
979
1045
  ...
980
1046
  };
@@ -990,20 +1056,9 @@ declare var it: {
990
1056
  */
991
1057
  (
992
1058
  name: JestTestName,
993
- fn?: (done: () => void) => ?Promise<mixed>,
1059
+ fn?: (done: JestDoneFn) => ?Promise<mixed>,
994
1060
  timeout?: number,
995
1061
  ): void,
996
- /**
997
- * each runs this test against array of argument arrays per each run
998
- *
999
- * @param {table} table of Test
1000
- */
1001
- each<TArguments: Array<mixed> | mixed>(
1002
- table: $ReadOnlyArray<TArguments>,
1003
- ): (
1004
- name: JestTestName,
1005
- fn?: (...args: TArguments) => ?Promise<mixed>,
1006
- ) => void,
1007
1062
  /**
1008
1063
  * Only run this test
1009
1064
  *
@@ -1011,19 +1066,20 @@ declare var it: {
1011
1066
  * @param {Function} Test
1012
1067
  * @param {number} Timeout for the test, in milliseconds.
1013
1068
  */
1014
- only(
1015
- name: JestTestName,
1016
- fn?: (done: () => void) => ?Promise<mixed>,
1017
- timeout?: number,
1018
- ): {
1019
- each<TArguments: Array<mixed> | mixed>(
1020
- table: $ReadOnlyArray<TArguments>,
1069
+ only: {|
1070
+ (
1071
+ name: JestTestName,
1072
+ fn?: (done: JestDoneFn) => ?Promise<mixed>,
1073
+ timeout?: number,
1074
+ ): void,
1075
+ each(
1076
+ ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
1021
1077
  ): (
1022
1078
  name: JestTestName,
1023
- fn?: (...args: TArguments) => ?Promise<mixed>,
1079
+ fn?: (...args: Array<any>) => ?Promise<mixed>,
1080
+ timeout?: number,
1024
1081
  ) => void,
1025
- ...
1026
- },
1082
+ |},
1027
1083
  /**
1028
1084
  * Skip running this test
1029
1085
  *
@@ -1031,11 +1087,26 @@ declare var it: {
1031
1087
  * @param {Function} Test
1032
1088
  * @param {number} Timeout for the test, in milliseconds.
1033
1089
  */
1034
- skip(
1035
- name: JestTestName,
1036
- fn?: (done: () => void) => ?Promise<mixed>,
1037
- timeout?: number,
1038
- ): void,
1090
+ skip: {|
1091
+ (
1092
+ name: JestTestName,
1093
+ fn?: (done: JestDoneFn) => ?Promise<mixed>,
1094
+ timeout?: number,
1095
+ ): void,
1096
+ each(
1097
+ ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
1098
+ ): (
1099
+ name: JestTestName,
1100
+ fn?: (...args: Array<any>) => ?Promise<mixed>,
1101
+ timeout?: number,
1102
+ ) => void,
1103
+ |},
1104
+ /**
1105
+ * Highlight planned tests in the summary output
1106
+ *
1107
+ * @param {String} Name of Test to do
1108
+ */
1109
+ todo(name: string): void,
1039
1110
  /**
1040
1111
  * Run the test concurrently
1041
1112
  *
@@ -1045,14 +1116,27 @@ declare var it: {
1045
1116
  */
1046
1117
  concurrent(
1047
1118
  name: JestTestName,
1048
- fn?: (done: () => void) => ?Promise<mixed>,
1119
+ fn?: (done: JestDoneFn) => ?Promise<mixed>,
1049
1120
  timeout?: number,
1050
1121
  ): void,
1122
+ /**
1123
+ * each runs this test against array of argument arrays per each run
1124
+ *
1125
+ * @param {table} table of Test
1126
+ */
1127
+ each(
1128
+ ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
1129
+ ): (
1130
+ name: JestTestName,
1131
+ fn?: (...args: Array<any>) => ?Promise<mixed>,
1132
+ timeout?: number,
1133
+ ) => void,
1051
1134
  ...
1052
1135
  };
1136
+
1053
1137
  declare function fit(
1054
1138
  name: JestTestName,
1055
- fn: (done: () => void) => ?Promise<mixed>,
1139
+ fn: (done: JestDoneFn) => ?Promise<mixed>,
1056
1140
  timeout?: number,
1057
1141
  ): void;
1058
1142
  /** An individual test unit */
@@ -1067,16 +1151,38 @@ declare var xit: typeof it;
1067
1151
  declare var xtest: typeof it;
1068
1152
 
1069
1153
  type JestPrettyFormatColors = {
1070
- comment: {close: string, open: string, ...},
1071
- content: {close: string, open: string, ...},
1072
- prop: {close: string, open: string, ...},
1073
- tag: {close: string, open: string, ...},
1074
- value: {close: string, open: string, ...},
1154
+ comment: {
1155
+ close: string,
1156
+ open: string,
1157
+ ...
1158
+ },
1159
+ content: {
1160
+ close: string,
1161
+ open: string,
1162
+ ...
1163
+ },
1164
+ prop: {
1165
+ close: string,
1166
+ open: string,
1167
+ ...
1168
+ },
1169
+ tag: {
1170
+ close: string,
1171
+ open: string,
1172
+ ...
1173
+ },
1174
+ value: {
1175
+ close: string,
1176
+ open: string,
1177
+ ...
1178
+ },
1075
1179
  ...
1076
1180
  };
1077
1181
 
1078
1182
  type JestPrettyFormatIndent = string => string;
1183
+ type JestPrettyFormatRefs = Array<any>;
1079
1184
  type JestPrettyFormatPrint = any => string;
1185
+ type JestPrettyFormatStringOrNull = string | null;
1080
1186
 
1081
1187
  type JestPrettyFormatOptions = {|
1082
1188
  callToJSON: boolean,
@@ -1123,8 +1229,8 @@ declare var expect: {
1123
1229
  DomTestingLibraryType &
1124
1230
  JestJQueryMatchersType &
1125
1231
  JestStyledComponentsMatchersType &
1126
- JestExtendedMatchersType,
1127
-
1232
+ JestExtendedMatchersType &
1233
+ SnapshotDiffType,
1128
1234
  /** Add additional Jasmine matchers to Jest's roster */
1129
1235
  extend(matchers: {[name: string]: JestMatcher, ...}): void,
1130
1236
  /** Add a module that formats application-specific data structures. */
@@ -1133,6 +1239,7 @@ declare var expect: {
1133
1239
  hasAssertions(): void,
1134
1240
  any(value: mixed): JestAsymmetricEqualityType,
1135
1241
  anything(): any,
1242
+ // MODIFIED: Array -> $ReadOnlyArray
1136
1243
  arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
1137
1244
  objectContaining(value: Object): Object,
1138
1245
  /** Matches any received string that contains the exact expected string. */
@@ -1155,18 +1262,6 @@ declare function spyOn(value: mixed, method: string): Object;
1155
1262
  /** Holds all functions related to manipulating test runner */
1156
1263
  declare var jest: JestObjectType;
1157
1264
 
1158
- /**
1159
- * https://jasmine.github.io/2.4/custom_reporter.html
1160
- */
1161
- type JasmineReporter = {
1162
- jasmineStarted?: (suiteInfo: mixed) => void,
1163
- suiteStarted?: (result: mixed) => void,
1164
- specStarted?: (result: mixed) => void,
1165
- specDone?: (result: mixed) => void,
1166
- suiteDone?: (result: mixed) => void,
1167
- ...
1168
- };
1169
-
1170
1265
  /**
1171
1266
  * The global Jasmine object, this is generally not exposed as the public API,
1172
1267
  * using features inside here could break in later versions of Jest.
@@ -1175,14 +1270,13 @@ declare var jasmine: {
1175
1270
  DEFAULT_TIMEOUT_INTERVAL: number,
1176
1271
  any(value: mixed): JestAsymmetricEqualityType,
1177
1272
  anything(): any,
1178
- arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
1273
+ arrayContaining(value: Array<mixed>): Array<mixed>,
1179
1274
  clock(): JestClockType,
1180
1275
  createSpy(name: string): JestSpyType,
1181
1276
  createSpyObj(
1182
1277
  baseName: string,
1183
1278
  methodNames: Array<string>,
1184
1279
  ): {[methodName: string]: JestSpyType, ...},
1185
- getEnv(): {addReporter: (jasmineReporter: JasmineReporter) => void, ...},
1186
1280
  objectContaining(value: Object): Object,
1187
1281
  stringMatching(value: string): string,
1188
1282
  ...