mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
Remove deep imports from the Jest preset (#58602)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58602 Use the React Native root and supported secondary entry points for public APIs used by the Jest preset. Resolve implementation modules through package-relative paths so the preset does not depend on unsupported package subpaths. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D120717568 fbshipit-source-id: d19036571e9d34938a4d616303e36548f508ea96
This commit is contained in:
committed by
meta-codesync[bot]
parent
649b404a7e
commit
ee4fc1d7ea
@@ -32,6 +32,8 @@ module.exports = {
|
||||
'<rootDir>/packages/react-native/src/react-private-interface.js',
|
||||
'^react-native/setup-env$':
|
||||
'<rootDir>/packages/react-native/src/setup-env.js',
|
||||
'^react-native/unstable-internals-do-not-use$':
|
||||
'<rootDir>/packages/react-native/src/unstable-internals-do-not-use.js',
|
||||
},
|
||||
setupFiles: ['./packages/jest-preset/jest/local-setup.js'],
|
||||
fakeTimers: {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof TActivityIndicator from 'react-native/Libraries/Components/ActivityIndicator/ActivityIndicator';
|
||||
import typeof {ActivityIndicator as TActivityIndicator} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof TImage from 'react-native/Libraries/Image/Image';
|
||||
import typeof {Image as TImage} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import type {ModalProps} from 'react-native/Libraries/Modal/Modal';
|
||||
import type {ModalProps} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {RefreshControlProps} from 'react-native/Libraries/Components/RefreshControl/RefreshControl';
|
||||
import type {RefreshControlProps} from 'react-native';
|
||||
import type {HostComponent} from 'react-native/src/private/types/HostComponent';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
||||
import typeof TScrollView from 'react-native/Libraries/Components/ScrollView/ScrollView';
|
||||
import typeof {ScrollView as TScrollView} from 'react-native';
|
||||
import type {ScrollViewNativeProps} from 'react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
||||
import typeof TText from 'react-native/Libraries/Text/Text';
|
||||
import typeof {Text as TText} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
||||
import typeof TTextInput from 'react-native/Libraries/Components/TextInput/TextInput';
|
||||
import typeof {TextInput as TTextInput} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import typeof * as TmockComponent from '../mockComponent';
|
||||
import typeof * as TMockNativeMethods from '../MockNativeMethods';
|
||||
import typeof TView from 'react-native/Libraries/Components/View/View';
|
||||
import typeof {View as TView} from 'react-native';
|
||||
|
||||
const mockComponent =
|
||||
jest.requireActual<TmockComponent>('../mockComponent').default;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
|
||||
import type {ViewProps} from 'react-native';
|
||||
|
||||
import * as React from 'react';
|
||||
import {createElement} from 'react';
|
||||
|
||||
Reference in New Issue
Block a user