jest-expo 53.0.4 → 53.0.6
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.
- package/package.json +3 -3
- package/src/preset/{expoModules.js → moduleMocks/expoModules.js} +396 -499
- package/src/preset/moduleMocks/internalExpoModules.js +34 -0
- package/src/preset/moduleMocks/thirdPartyModules.js +191 -0
- package/src/preset/setup.js +8 -7
- package/src/preset/internalExpoModules.js +0 -7
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
DevLoadingView: {
|
|
3
|
+
getConstants: { type: 'function' },
|
|
4
|
+
addListener: { type: 'function', functionType: 'async' },
|
|
5
|
+
removeListeners: { type: 'function', functionType: 'async' },
|
|
6
|
+
},
|
|
7
|
+
NativeUnimoduleProxy: {
|
|
8
|
+
callMethod: { type: 'function', functionType: 'promise' },
|
|
9
|
+
exportedMethods: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
mock: {
|
|
12
|
+
ExponentGLObjectManager: [
|
|
13
|
+
{ name: 'createContextAsync', argumentsCount: 0, key: 0 },
|
|
14
|
+
{ name: 'destroyContextAsync', argumentsCount: 1, key: 1 },
|
|
15
|
+
{ name: 'destroyObjectAsync', argumentsCount: 1, key: 2 },
|
|
16
|
+
{ name: 'createCameraTextureAsync', argumentsCount: 2, key: 3 },
|
|
17
|
+
{ name: 'takeSnapshotAsync', argumentsCount: 2, key: 4 },
|
|
18
|
+
],
|
|
19
|
+
ExpoSplashScreen: [
|
|
20
|
+
{ name: 'hide', argumentsCount: 0, key: 'hide' },
|
|
21
|
+
{ name: 'hideAsync', argumentsCount: 0, key: 'hideAsync' },
|
|
22
|
+
{ name: 'internalMaybeHideAsync', argumentsCount: 0, key: 'internalMaybeHideAsync' },
|
|
23
|
+
{
|
|
24
|
+
name: 'internalPreventAutoHideAsync',
|
|
25
|
+
argumentsCount: 0,
|
|
26
|
+
key: 'internalPreventAutoHideAsync',
|
|
27
|
+
},
|
|
28
|
+
{ name: 'preventAutoHideAsync', argumentsCount: 0, key: 'preventAutoHideAsync' },
|
|
29
|
+
{ name: 'setOptions', argumentsCount: 1, key: 'setOptions' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
AIRMapCalloutManager: {},
|
|
3
|
+
AIRMapCalloutSubviewManager: {},
|
|
4
|
+
AIRMapCircleManager: {},
|
|
5
|
+
AIRMapLocalTileManager: {},
|
|
6
|
+
AIRMapManager: {
|
|
7
|
+
animateCamera: { type: 'function', functionType: 'async' },
|
|
8
|
+
animateToRegion: { type: 'function', functionType: 'async' },
|
|
9
|
+
coordinateForPoint: { type: 'function', functionType: 'promise' },
|
|
10
|
+
fitToCoordinates: { type: 'function', functionType: 'async' },
|
|
11
|
+
fitToElements: { type: 'function', functionType: 'async' },
|
|
12
|
+
fitToSuppliedMarkers: { type: 'function', functionType: 'async' },
|
|
13
|
+
getAddressFromCoordinates: { type: 'function', functionType: 'promise' },
|
|
14
|
+
getCamera: { type: 'function', functionType: 'promise' },
|
|
15
|
+
getConstants: { type: 'function' },
|
|
16
|
+
getMapBoundaries: { type: 'function', functionType: 'promise' },
|
|
17
|
+
getMarkersFrames: { type: 'function', functionType: 'promise' },
|
|
18
|
+
pointForCoordinate: { type: 'function', functionType: 'promise' },
|
|
19
|
+
setCamera: { type: 'function', functionType: 'async' },
|
|
20
|
+
takeSnapshot: { type: 'function', functionType: 'async' },
|
|
21
|
+
},
|
|
22
|
+
AIRMapMarkerManager: {
|
|
23
|
+
getConstants: { type: 'function' },
|
|
24
|
+
hideCallout: { type: 'function', functionType: 'async' },
|
|
25
|
+
redrawCallout: { type: 'function', functionType: 'async' },
|
|
26
|
+
showCallout: { type: 'function', functionType: 'async' },
|
|
27
|
+
},
|
|
28
|
+
AIRMapOverlayManager: {},
|
|
29
|
+
AIRMapPolygonManager: {},
|
|
30
|
+
AIRMapPolylineManager: {},
|
|
31
|
+
AIRMapUrlTileManager: {},
|
|
32
|
+
AIRMapWMSTileManager: {},
|
|
33
|
+
ExpoModulesCore: {
|
|
34
|
+
getConstants: { type: 'function' },
|
|
35
|
+
installModules: { type: 'function', functionType: 'sync' },
|
|
36
|
+
},
|
|
37
|
+
'ExpoModulesCore.ViewModuleWrapper': {},
|
|
38
|
+
ExponentScopedModuleRegistry: {},
|
|
39
|
+
ExponentTest: {
|
|
40
|
+
action: { type: 'function', functionType: 'promise' },
|
|
41
|
+
completed: { type: 'function', functionType: 'async' },
|
|
42
|
+
getConstants: { type: 'function' },
|
|
43
|
+
isInCI: { type: 'number', mock: 0 },
|
|
44
|
+
log: { type: 'function', functionType: 'async' },
|
|
45
|
+
shouldSkipTestsRequiringPermissionsAsync: { type: 'function', functionType: 'promise' },
|
|
46
|
+
},
|
|
47
|
+
ExponentUtil: {},
|
|
48
|
+
LottieAnimationView: {
|
|
49
|
+
getConstants: { type: 'function' },
|
|
50
|
+
pause: { type: 'function', functionType: 'async' },
|
|
51
|
+
play: { type: 'function', functionType: 'async' },
|
|
52
|
+
reset: { type: 'function', functionType: 'async' },
|
|
53
|
+
resume: { type: 'function', functionType: 'async' },
|
|
54
|
+
VERSION: { type: 'number', mock: 1 },
|
|
55
|
+
},
|
|
56
|
+
ReanimatedModule: {
|
|
57
|
+
addListener: { type: 'function', functionType: 'async' },
|
|
58
|
+
getConstants: { type: 'function' },
|
|
59
|
+
installTurboModule: { type: 'function', functionType: 'sync' },
|
|
60
|
+
removeListeners: { type: 'function', functionType: 'async' },
|
|
61
|
+
},
|
|
62
|
+
RNAWSCognito: {
|
|
63
|
+
computeModPow: { type: 'function', functionType: 'async' },
|
|
64
|
+
computeS: { type: 'function', functionType: 'async' },
|
|
65
|
+
getConstants: { type: 'function' },
|
|
66
|
+
getRandomBase64: { type: 'function', functionType: 'sync' },
|
|
67
|
+
},
|
|
68
|
+
RNCMaskedViewManager: {},
|
|
69
|
+
RNCNetInfo: {
|
|
70
|
+
addListener: { type: 'function', functionType: 'async' },
|
|
71
|
+
configure: { type: 'function', functionType: 'async' },
|
|
72
|
+
getConstants: { type: 'function' },
|
|
73
|
+
getCurrentState: { type: 'function', functionType: 'promise' },
|
|
74
|
+
removeListeners: { type: 'function', functionType: 'async' },
|
|
75
|
+
},
|
|
76
|
+
RNCPickerManager: {},
|
|
77
|
+
RNCSafeAreaContext: {
|
|
78
|
+
getConstants: { type: 'function' },
|
|
79
|
+
initialWindowMetrics: { type: 'object' },
|
|
80
|
+
},
|
|
81
|
+
RNCSafeAreaProvider: {},
|
|
82
|
+
RNCSafeAreaView: {},
|
|
83
|
+
RNCSegmentedControlManager: {},
|
|
84
|
+
RNCSliderManager: {},
|
|
85
|
+
RNCViewPager: {
|
|
86
|
+
getConstants: { type: 'function' },
|
|
87
|
+
setPage: { type: 'function', functionType: 'async' },
|
|
88
|
+
setPageWithoutAnimation: { type: 'function', functionType: 'async' },
|
|
89
|
+
setScrollEnabledImperatively: { type: 'function', functionType: 'async' },
|
|
90
|
+
},
|
|
91
|
+
RNCWebView: {
|
|
92
|
+
clearCache: { type: 'function', functionType: 'async' },
|
|
93
|
+
getConstants: { type: 'function' },
|
|
94
|
+
goBack: { type: 'function', functionType: 'async' },
|
|
95
|
+
goForward: { type: 'function', functionType: 'async' },
|
|
96
|
+
injectJavaScript: { type: 'function', functionType: 'async' },
|
|
97
|
+
postMessage: { type: 'function', functionType: 'async' },
|
|
98
|
+
reload: { type: 'function', functionType: 'async' },
|
|
99
|
+
requestFocus: { type: 'function', functionType: 'async' },
|
|
100
|
+
shouldStartLoadWithLockIdentifier: { type: 'function', functionType: 'async' },
|
|
101
|
+
stopLoading: { type: 'function', functionType: 'async' },
|
|
102
|
+
},
|
|
103
|
+
RNDateTimePickerManager: {},
|
|
104
|
+
RNEdgeToEdge: {
|
|
105
|
+
onColorSchemeChange: { type: 'function', functionType: 'sync' },
|
|
106
|
+
setStatusBarStyle: { type: 'function', functionType: 'sync' },
|
|
107
|
+
setNavigationBarStyle: { type: 'function', functionType: 'sync' },
|
|
108
|
+
setStatusBarHidden: { type: 'function', functionType: 'sync' },
|
|
109
|
+
setNavigationBarHidden: { type: 'function', functionType: 'sync' },
|
|
110
|
+
},
|
|
111
|
+
RNGestureHandlerButton: {},
|
|
112
|
+
RNGestureHandlerModule: {
|
|
113
|
+
addListener: { type: 'function', functionType: 'async' },
|
|
114
|
+
attachGestureHandler: { type: 'function', functionType: 'async' },
|
|
115
|
+
createGestureHandler: { type: 'function', functionType: 'async' },
|
|
116
|
+
Direction: { type: 'object' },
|
|
117
|
+
dropGestureHandler: { type: 'function', functionType: 'async' },
|
|
118
|
+
flushOperations: { type: 'function', functionType: 'async' },
|
|
119
|
+
getConstants: { type: 'function' },
|
|
120
|
+
handleClearJSResponder: { type: 'function', functionType: 'async' },
|
|
121
|
+
handleSetJSResponder: { type: 'function', functionType: 'async' },
|
|
122
|
+
removeListeners: { type: 'function', functionType: 'async' },
|
|
123
|
+
State: { type: 'object' },
|
|
124
|
+
updateGestureHandler: { type: 'function', functionType: 'async' },
|
|
125
|
+
},
|
|
126
|
+
RNSFullWindowOverlayManager: {},
|
|
127
|
+
RNSkiaModule: {
|
|
128
|
+
getConstants: { type: 'function' },
|
|
129
|
+
install: { type: 'function', functionType: 'sync' },
|
|
130
|
+
},
|
|
131
|
+
RNSModalScreenManager: {},
|
|
132
|
+
RNSModule: {},
|
|
133
|
+
RNSScreenContainerManager: {},
|
|
134
|
+
RNSScreenManager: {},
|
|
135
|
+
RNSScreenNavigationContainerManager: {},
|
|
136
|
+
RNSScreenStackHeaderConfigManager: {},
|
|
137
|
+
RNSScreenStackHeaderSubviewManager: {},
|
|
138
|
+
RNSScreenStackManager: {},
|
|
139
|
+
RNSSearchBarManager: {
|
|
140
|
+
blur: { type: 'function', functionType: 'async' },
|
|
141
|
+
cancelSearch: { type: 'function', functionType: 'async' },
|
|
142
|
+
clearText: { type: 'function', functionType: 'async' },
|
|
143
|
+
focus: { type: 'function', functionType: 'async' },
|
|
144
|
+
getConstants: { type: 'function' },
|
|
145
|
+
setText: { type: 'function', functionType: 'async' },
|
|
146
|
+
toggleCancelButton: { type: 'function', functionType: 'async' },
|
|
147
|
+
},
|
|
148
|
+
RNSVGCircleManager: {},
|
|
149
|
+
RNSVGClipPathManager: {},
|
|
150
|
+
RNSVGDefsManager: {},
|
|
151
|
+
RNSVGEllipseManager: {},
|
|
152
|
+
RNSVGForeignObjectManager: {},
|
|
153
|
+
RNSVGGroupManager: {},
|
|
154
|
+
RNSVGImageManager: {},
|
|
155
|
+
RNSVGLinearGradientManager: {},
|
|
156
|
+
RNSVGLineManager: {},
|
|
157
|
+
RNSVGMarkerManager: {},
|
|
158
|
+
RNSVGMaskManager: {},
|
|
159
|
+
RNSVGNodeManager: {},
|
|
160
|
+
RNSVGPathManager: {},
|
|
161
|
+
RNSVGPatternManager: {},
|
|
162
|
+
RNSVGRadialGradientManager: {},
|
|
163
|
+
RNSVGRectManager: {},
|
|
164
|
+
RNSVGRenderableManager: {},
|
|
165
|
+
RNSVGRenderableModule: {
|
|
166
|
+
getBBox: { type: 'function', functionType: 'sync' },
|
|
167
|
+
getConstants: { type: 'function' },
|
|
168
|
+
getCTM: { type: 'function', functionType: 'sync' },
|
|
169
|
+
getPointAtLength: { type: 'function', functionType: 'sync' },
|
|
170
|
+
getScreenCTM: { type: 'function', functionType: 'sync' },
|
|
171
|
+
getTotalLength: { type: 'function', functionType: 'sync' },
|
|
172
|
+
isPointInFill: { type: 'function', functionType: 'sync' },
|
|
173
|
+
isPointInStroke: { type: 'function', functionType: 'sync' },
|
|
174
|
+
},
|
|
175
|
+
RNSVGSvgViewManager: {},
|
|
176
|
+
RNSVGSvgViewModule: {
|
|
177
|
+
getConstants: { type: 'function' },
|
|
178
|
+
toDataURL: { type: 'function', functionType: 'async' },
|
|
179
|
+
},
|
|
180
|
+
RNSVGSymbolManager: {},
|
|
181
|
+
RNSVGTextManager: {},
|
|
182
|
+
RNSVGTextPathManager: {},
|
|
183
|
+
RNSVGTSpanManager: {},
|
|
184
|
+
RNSVGUseManager: {},
|
|
185
|
+
RNViewShot: {
|
|
186
|
+
captureRef: { type: 'function', functionType: 'promise' },
|
|
187
|
+
captureScreen: { type: 'function', functionType: 'promise' },
|
|
188
|
+
getConstants: { type: 'function' },
|
|
189
|
+
releaseCapture: { type: 'function', functionType: 'async' },
|
|
190
|
+
},
|
|
191
|
+
};
|
package/src/preset/setup.js
CHANGED
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
+
import merge from 'lodash/merge';
|
|
8
|
+
|
|
7
9
|
const findUp = require('find-up');
|
|
8
10
|
const path = require('path');
|
|
9
11
|
const mockNativeModules = require('react-native/Libraries/BatchedBridge/NativeModules').default;
|
|
10
12
|
const stackTrace = require('stacktrace-js');
|
|
11
13
|
|
|
12
|
-
const publicExpoModules = require('./expoModules');
|
|
13
|
-
const internalExpoModules = require('./internalExpoModules');
|
|
14
|
+
const publicExpoModules = require('./moduleMocks/expoModules');
|
|
15
|
+
const internalExpoModules = require('./moduleMocks/internalExpoModules');
|
|
16
|
+
const thirdPartyModules = require('./moduleMocks/thirdPartyModules');
|
|
14
17
|
|
|
15
18
|
// window isn't defined as of react-native 0.45+ it seems
|
|
16
19
|
if (typeof window !== 'object') {
|
|
@@ -51,10 +54,7 @@ Object.defineProperty(mockNativeModules, 'LinkingManager', {
|
|
|
51
54
|
get: () => mockNativeModules.Linking,
|
|
52
55
|
});
|
|
53
56
|
|
|
54
|
-
const expoModules =
|
|
55
|
-
...publicExpoModules,
|
|
56
|
-
...internalExpoModules,
|
|
57
|
-
};
|
|
57
|
+
const expoModules = merge(publicExpoModules, merge(thirdPartyModules, internalExpoModules));
|
|
58
58
|
|
|
59
59
|
// Mock the experience URL in development mode for asset setup
|
|
60
60
|
expoModules.NativeUnimoduleProxy.modulesConstants.mockDefinition.ExponentConstants.experienceUrl.mock =
|
|
@@ -252,7 +252,8 @@ try {
|
|
|
252
252
|
// Support auto-mocking of expo-modules that:
|
|
253
253
|
// 1. have a mock in the `mocks` directory
|
|
254
254
|
// 2. the native module (e.g. ExpoCrypto) name matches the package name (expo-crypto)
|
|
255
|
-
const nativeModuleMock =
|
|
255
|
+
const nativeModuleMock =
|
|
256
|
+
attemptLookup(name) ?? ExpoModulesCore.requireOptionalNativeModule(name);
|
|
256
257
|
if (!nativeModuleMock) {
|
|
257
258
|
return null;
|
|
258
259
|
}
|