mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 22:47:02 +08:00
Get Jest running in NavigationPlayground
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!((jest-)?react-native|react-navigation|@react-navigation/.*))"
|
||||
],
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
"tsConfig": "tsconfig.jest.json"
|
||||
|
||||
@@ -3,3 +3,44 @@ import { NativeModules } from 'react-native';
|
||||
NativeModules.ReactLocalization = {
|
||||
language: 'en',
|
||||
};
|
||||
|
||||
// TODO: remove these mocks!
|
||||
jest.mock('react-native-gesture-handler', () => {
|
||||
const View = require('react-native/Libraries/Components/View/View');
|
||||
return {
|
||||
Swipeable: View,
|
||||
DrawerLayout: View,
|
||||
State: {},
|
||||
ScrollView: View,
|
||||
Slider: View,
|
||||
Switch: View,
|
||||
TextInput: View,
|
||||
ToolbarAndroid: View,
|
||||
ViewPagerAndroid: View,
|
||||
DrawerLayoutAndroid: View,
|
||||
WebView: View,
|
||||
NativeViewGestureHandler: View,
|
||||
TapGestureHandler: View,
|
||||
FlingGestureHandler: View,
|
||||
ForceTouchGestureHandler: View,
|
||||
LongPressGestureHandler: View,
|
||||
PanGestureHandler: View,
|
||||
PinchGestureHandler: View,
|
||||
RotationGestureHandler: View,
|
||||
/* Buttons */
|
||||
RawButton: View,
|
||||
BaseButton: View,
|
||||
RectButton: View,
|
||||
BorderlessButton: View,
|
||||
/* Other */
|
||||
FlatList: View,
|
||||
gestureHandlerRootHOC: jest.fn(),
|
||||
Directions: {},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('react-native-gesture-handler/DrawerLayout', () => {
|
||||
return {
|
||||
Directions: null,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user