jest-expo 51.0.3 → 52.0.0-canary-20240627-1402f4b
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 +4 -4
- package/src/preset/setup.js +13 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-expo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "52.0.0-canary-20240627-1402f4b",
|
|
4
4
|
"description": "A Jest preset to painlessly test your Expo / React Native apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"preset": "jest-expo/universal"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@expo/config": "
|
|
35
|
-
"@expo/json-file": "
|
|
34
|
+
"@expo/config": "9.0.3-canary-20240627-1402f4b",
|
|
35
|
+
"@expo/json-file": "8.3.4-canary-20240627-1402f4b",
|
|
36
36
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
37
37
|
"babel-jest": "^29.2.1",
|
|
38
38
|
"find-up": "^5.0.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"url": "https://github.com/expo/expo/issues"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/expo/expo/tree/main/packages/jest-expo",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "1402f4bcfdfcec328fc1e20cf1656bbefe7c3b7b"
|
|
52
52
|
}
|
package/src/preset/setup.js
CHANGED
|
@@ -183,11 +183,10 @@ jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
|
|
|
183
183
|
}));
|
|
184
184
|
|
|
185
185
|
// Mock the `createSnapshotFriendlyRef` to return an ref that can be serialized in snapshots.
|
|
186
|
-
jest.doMock('expo-modules-core/
|
|
186
|
+
jest.doMock('expo-modules-core/src/Refs', () => ({
|
|
187
187
|
createSnapshotFriendlyRef: () => {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const ref = Object.create(createSnapshotFriendlyRef());
|
|
188
|
+
// We cannot use `createRef` since it is not extensible.
|
|
189
|
+
const ref = { current: null };
|
|
191
190
|
Object.defineProperty(ref, 'toJSON', {
|
|
192
191
|
value: () => '[React.ref]',
|
|
193
192
|
});
|
|
@@ -215,7 +214,7 @@ function attemptLookup(moduleName) {
|
|
|
215
214
|
try {
|
|
216
215
|
jest.doMock('expo-modules-core', () => {
|
|
217
216
|
const ExpoModulesCore = jest.requireActual('expo-modules-core');
|
|
218
|
-
const uuid = jest.requireActual('expo-modules-core/
|
|
217
|
+
const uuid = jest.requireActual('expo-modules-core/src/uuid/uuid.web');
|
|
219
218
|
|
|
220
219
|
const { EventEmitter, NativeModule, SharedObject } = globalThis.expo;
|
|
221
220
|
|
|
@@ -262,6 +261,13 @@ try {
|
|
|
262
261
|
}
|
|
263
262
|
return nativeModule;
|
|
264
263
|
},
|
|
264
|
+
requireNativeViewManager: (name) => {
|
|
265
|
+
const nativeModuleMock = attemptLookup(name);
|
|
266
|
+
if (!nativeModuleMock || !nativeModuleMock.View) {
|
|
267
|
+
return ExpoModulesCore.requireNativeViewManager(name);
|
|
268
|
+
}
|
|
269
|
+
return nativeModuleMock.View;
|
|
270
|
+
},
|
|
265
271
|
};
|
|
266
272
|
});
|
|
267
273
|
} catch (error) {
|
|
@@ -272,7 +278,7 @@ try {
|
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
// Installs web implementations of global things that are normally installed through JSI.
|
|
275
|
-
require('expo-modules-core/
|
|
281
|
+
require('expo-modules-core/src/web/index.web');
|
|
276
282
|
|
|
277
283
|
// Ensure the environment globals are installed before the first test runs.
|
|
278
|
-
require('expo/
|
|
284
|
+
require('expo/src/winter');
|