jest-expo 50.0.4 → 51.0.0-canary-20240318-53194f5

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.
@@ -4,7 +4,16 @@ const { getBareExtensions } = require('@expo/config/paths');
4
4
  const { withWatchPlugins } = require('./withWatchPlugins');
5
5
  const expoPreset = require('../jest-preset');
6
6
 
7
- function getPlatformPreset(displayOptions, extensions) {
7
+ function getUpstreamBabelJest(transform) {
8
+ const upstreamBabelJest = Object.keys(transform).find((key) =>
9
+ Array.isArray(transform[key])
10
+ ? transform[key][0] === 'babel-jest'
11
+ : transform[key] === 'babel-jest'
12
+ );
13
+ return upstreamBabelJest;
14
+ }
15
+
16
+ function getPlatformPreset(displayOptions, extensions, platform, isServer) {
8
17
  const moduleFileExtensions = getBareExtensions(extensions, {
9
18
  isTS: true,
10
19
  isReact: true,
@@ -20,7 +29,26 @@ function getPlatformPreset(displayOptions, extensions) {
20
29
  ];
21
30
  });
22
31
 
32
+ const upstreamBabelJest = getUpstreamBabelJest(expoPreset.transform) ?? '\\.[jt]sx?$';
33
+
23
34
  return withWatchPlugins({
35
+ transform: {
36
+ ...expoPreset.transform,
37
+ [upstreamBabelJest]: [
38
+ 'babel-jest',
39
+ {
40
+ caller: {
41
+ name: 'metro',
42
+ bundler: 'metro',
43
+ // Add support for the `platform` babel transforms and inlines such as
44
+ // Platform.OS and `process.env.EXPO_OS`.
45
+ platform,
46
+ // Add support for removing server related code from the bundle.
47
+ isServer,
48
+ },
49
+ },
50
+ ],
51
+ },
24
52
  displayName: displayOptions,
25
53
  testMatch,
26
54
  moduleFileExtensions,
@@ -52,27 +80,31 @@ module.exports = {
52
80
  getWebPreset() {
53
81
  return {
54
82
  ...getBaseWebPreset(),
55
- ...getPlatformPreset({ name: 'Web', color: 'magenta' }, ['web']),
83
+ ...getPlatformPreset({ name: 'Web', color: 'magenta' }, ['web'], 'web'),
56
84
  testEnvironment: 'jsdom',
57
85
  };
58
86
  },
59
87
  getNodePreset() {
60
88
  return {
61
89
  ...getBaseWebPreset(),
62
- ...getPlatformPreset({ name: 'Node', color: 'cyan' }, ['node', 'web']),
90
+ ...getPlatformPreset({ name: 'Node', color: 'cyan' }, ['node', 'web'], 'web', true),
63
91
  testEnvironment: 'node',
64
92
  };
65
93
  },
66
94
  getIOSPreset() {
67
95
  return {
68
96
  ...expoPreset,
69
- ...getPlatformPreset({ name: 'iOS', color: 'white' }, ['ios', 'native']),
97
+ ...getPlatformPreset({ name: 'iOS', color: 'white' }, ['ios', 'native'], 'ios'),
70
98
  };
71
99
  },
72
100
  getAndroidPreset() {
73
101
  return {
74
102
  ...expoPreset,
75
- ...getPlatformPreset({ name: 'Android', color: 'blueBright' }, ['android', 'native']),
103
+ ...getPlatformPreset(
104
+ { name: 'Android', color: 'blueBright' },
105
+ ['android', 'native'],
106
+ 'android'
107
+ ),
76
108
  };
77
109
  },
78
110
  };
package/jest-preset.js CHANGED
@@ -14,13 +14,19 @@ jestPreset.moduleNameMapper = {
14
14
  '^react-native-vector-icons/(.*)': '@expo/vector-icons/$1',
15
15
  };
16
16
 
17
- // transform
18
- if (!jestPreset.transform) {
19
- jestPreset.transform = {
20
- '\\.[jt]sx?$': 'babel-jest',
21
- };
17
+ const upstreamBabelJest = Object.keys(jestPreset.transform).find(
18
+ (key) => jestPreset.transform[key] === 'babel-jest'
19
+ );
20
+ if (upstreamBabelJest) {
21
+ delete jestPreset.transform[upstreamBabelJest];
22
22
  }
23
23
 
24
+ // transform
25
+ jestPreset.transform['\\.[jt]sx?$'] = [
26
+ 'babel-jest',
27
+ { caller: { name: 'metro', bundler: 'metro', platform: 'ios' } },
28
+ ];
29
+
24
30
  const defaultAssetNamePattern = '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$';
25
31
  if (!jestPreset.transform[defaultAssetNamePattern]) {
26
32
  console.warn(`Expected react-native/jest-preset to define transform[${defaultAssetNamePattern}]`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "50.0.4",
3
+ "version": "51.0.0-canary-20240318-53194f5",
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": "~8.5.0",
35
- "@expo/json-file": "^8.2.37",
34
+ "@expo/config": "0.0.1-canary-20240318-53194f5",
35
+ "@expo/json-file": "0.0.1-canary-20240318-53194f5",
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": "d846eb40fc384b9e4b21260af2a990dfe79cf461"
51
+ "gitHead": "53194f5a28486753217acecf3d79a95dca79283d"
52
52
  }
@@ -64,16 +64,29 @@ module.exports = {
64
64
  AIRMapPolylineManager: {},
65
65
  AIRMapUrlTileManager: {},
66
66
  AIRMapWMSTileManager: {},
67
- ExpoBridgeModule: {
68
- getConstants: { type: 'function' },
69
- installModules: { type: 'function', functionType: 'sync' },
70
- },
67
+ ExpoBridgeModule: {},
71
68
  'ExpoModulesCore.ViewModuleWrapper': {},
72
69
  ExpoNativeModuleIntrospection: {
73
70
  getConstants: { type: 'function' },
74
71
  getNativeModuleNamesAsync: { type: 'function', functionType: 'promise' },
75
72
  introspectNativeModuleAsync: { type: 'function', functionType: 'promise' },
76
73
  },
74
+ ExponentNotifications: {
75
+ cancelAllScheduledNotificationsAsync: { type: 'function', functionType: 'promise' },
76
+ cancelScheduledNotificationAsync: { type: 'function', functionType: 'promise' },
77
+ createCategoryAsync: { type: 'function', functionType: 'promise' },
78
+ deleteCategoryAsync: { type: 'function', functionType: 'promise' },
79
+ getBadgeNumberAsync: { type: 'function', functionType: 'promise' },
80
+ getConstants: { type: 'function' },
81
+ getDevicePushTokenAsync: { type: 'function', functionType: 'promise' },
82
+ getExponentPushTokenAsync: { type: 'function', functionType: 'promise' },
83
+ legacyScheduleLocalRepeatingNotification: { type: 'function', functionType: 'promise' },
84
+ presentLocalNotification: { type: 'function', functionType: 'promise' },
85
+ scheduleLocalNotification: { type: 'function', functionType: 'promise' },
86
+ scheduleNotificationWithCalendar: { type: 'function', functionType: 'promise' },
87
+ scheduleNotificationWithTimer: { type: 'function', functionType: 'promise' },
88
+ setBadgeNumberAsync: { type: 'function', functionType: 'promise' },
89
+ },
77
90
  ExponentScopedModuleRegistry: {},
78
91
  ExponentTest: {
79
92
  action: { type: 'function', functionType: 'promise' },
@@ -107,24 +120,16 @@ module.exports = {
107
120
  { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
108
121
  ],
109
122
  ExpoApplication: [
110
- {
111
- name: 'getApplicationReleaseTypeAsync',
112
- argumentsCount: 0,
113
- key: 'getApplicationReleaseTypeAsync',
114
- },
115
- { name: 'getInstallationTimeAsync', argumentsCount: 0, key: 'getInstallationTimeAsync' },
116
- { name: 'getIosIdForVendorAsync', argumentsCount: 0, key: 'getIosIdForVendorAsync' },
117
- {
118
- name: 'getPushNotificationServiceEnvironmentAsync',
119
- argumentsCount: 0,
120
- key: 'getPushNotificationServiceEnvironmentAsync',
121
- },
123
+ { name: 'getIosIdForVendorAsync', argumentsCount: 0, key: 0 },
124
+ { name: 'getPushNotificationServiceEnvironmentAsync', argumentsCount: 0, key: 1 },
125
+ { name: 'getApplicationReleaseTypeAsync', argumentsCount: 0, key: 2 },
126
+ { name: 'getInstallationTimeAsync', argumentsCount: 0, key: 3 },
122
127
  ],
123
128
  ExpoBackgroundFetch: [
124
- { name: 'getStatusAsync', argumentsCount: 0, key: 'getStatusAsync' },
125
- { name: 'registerTaskAsync', argumentsCount: 2, key: 'registerTaskAsync' },
126
- { name: 'setMinimumIntervalAsync', argumentsCount: 1, key: 'setMinimumIntervalAsync' },
127
- { name: 'unregisterTaskAsync', argumentsCount: 1, key: 'unregisterTaskAsync' },
129
+ { name: 'unregisterTaskAsync', argumentsCount: 1, key: 0 },
130
+ { name: 'setMinimumIntervalAsync', argumentsCount: 1, key: 1 },
131
+ { name: 'getStatusAsync', argumentsCount: 0, key: 2 },
132
+ { name: 'registerTaskAsync', argumentsCount: 2, key: 3 },
128
133
  ],
129
134
  ExpoBackgroundNotificationTasksModule: [
130
135
  { name: 'unregisterTaskAsync', argumentsCount: 1, key: 0 },
@@ -140,10 +145,8 @@ module.exports = {
140
145
  { name: 'scanFromURLAsync', argumentsCount: 2, key: 'scanFromURLAsync' },
141
146
  ],
142
147
  ExpoBarometer: [
143
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
144
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
145
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
146
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
148
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
149
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
147
150
  ],
148
151
  ExpoBattery: [
149
152
  { name: 'getBatteryLevelAsync', argumentsCount: 0, key: 'getBatteryLevelAsync' },
@@ -204,70 +207,6 @@ module.exports = {
204
207
  { name: 'saveReminderAsync', argumentsCount: 1, key: 17 },
205
208
  { name: 'getSourceByIdAsync', argumentsCount: 1, key: 18 },
206
209
  ],
207
- ExpoCamera: [
208
- { name: 'getAvailablePictureSizes', argumentsCount: 2, key: 'getAvailablePictureSizes' },
209
- {
210
- name: 'getAvailableVideoCodecsAsync',
211
- argumentsCount: 0,
212
- key: 'getAvailableVideoCodecsAsync',
213
- },
214
- {
215
- name: 'getCameraPermissionsAsync',
216
- argumentsCount: 0,
217
- key: 'getCameraPermissionsAsync',
218
- },
219
- {
220
- name: 'getMicrophonePermissionsAsync',
221
- argumentsCount: 0,
222
- key: 'getMicrophonePermissionsAsync',
223
- },
224
- { name: 'getPermissionsAsync', argumentsCount: 0, key: 'getPermissionsAsync' },
225
- { name: 'pausePreview', argumentsCount: 1, key: 'pausePreview' },
226
- { name: 'record', argumentsCount: 2, key: 'record' },
227
- {
228
- name: 'requestCameraPermissionsAsync',
229
- argumentsCount: 0,
230
- key: 'requestCameraPermissionsAsync',
231
- },
232
- {
233
- name: 'requestMicrophonePermissionsAsync',
234
- argumentsCount: 0,
235
- key: 'requestMicrophonePermissionsAsync',
236
- },
237
- { name: 'requestPermissionsAsync', argumentsCount: 0, key: 'requestPermissionsAsync' },
238
- { name: 'resumePreview', argumentsCount: 1, key: 'resumePreview' },
239
- { name: 'stopRecording', argumentsCount: 1, key: 'stopRecording' },
240
- { name: 'takePicture', argumentsCount: 2, key: 'takePicture' },
241
- ],
242
- ExpoCameraNext: [
243
- { name: 'dismissScanner', argumentsCount: 0, key: 'dismissScanner' },
244
- {
245
- name: 'getAvailableVideoCodecsAsync',
246
- argumentsCount: 0,
247
- key: 'getAvailableVideoCodecsAsync',
248
- },
249
- {
250
- name: 'getCameraPermissionsAsync',
251
- argumentsCount: 0,
252
- key: 'getCameraPermissionsAsync',
253
- },
254
- {
255
- name: 'getMicrophonePermissionsAsync',
256
- argumentsCount: 0,
257
- key: 'getMicrophonePermissionsAsync',
258
- },
259
- { name: 'launchScanner', argumentsCount: 1, key: 'launchScanner' },
260
- {
261
- name: 'requestCameraPermissionsAsync',
262
- argumentsCount: 0,
263
- key: 'requestCameraPermissionsAsync',
264
- },
265
- {
266
- name: 'requestMicrophonePermissionsAsync',
267
- argumentsCount: 0,
268
- key: 'requestMicrophonePermissionsAsync',
269
- },
270
- ],
271
210
  ExpoCellular: [
272
211
  { name: 'allowsVoipAsync', argumentsCount: 0, key: 'allowsVoipAsync' },
273
212
  { name: 'getCarrierNameAsync', argumentsCount: 0, key: 'getCarrierNameAsync' },
@@ -321,24 +260,18 @@ module.exports = {
321
260
  { name: 'getDocumentAsync', argumentsCount: 1, key: 'getDocumentAsync' },
322
261
  ],
323
262
  ExpoFontLoader: [{ name: 'loadAsync', argumentsCount: 2, key: 0 }],
324
- ExpoGo: [],
325
263
  ExpoHaptics: [
326
264
  { name: 'impactAsync', argumentsCount: 1, key: 'impactAsync' },
327
265
  { name: 'notificationAsync', argumentsCount: 1, key: 'notificationAsync' },
328
266
  { name: 'selectionAsync', argumentsCount: 0, key: 'selectionAsync' },
329
267
  ],
330
- ExpoHead: [
331
- { name: 'clearActivitiesAsync', argumentsCount: 1, key: 'clearActivitiesAsync' },
332
- { name: 'createActivity', argumentsCount: 1, key: 'createActivity' },
333
- { name: 'getLaunchActivity', argumentsCount: 0, key: 'getLaunchActivity' },
334
- { name: 'revokeActivity', argumentsCount: 1, key: 'revokeActivity' },
335
- { name: 'suspendActivity', argumentsCount: 1, key: 'suspendActivity' },
336
- ],
337
268
  ExpoImage: [
338
269
  { name: 'clearDiskCache', argumentsCount: 0, key: 'clearDiskCache' },
339
270
  { name: 'clearMemoryCache', argumentsCount: 0, key: 'clearMemoryCache' },
271
+ { name: 'prefetch', argumentsCount: 1, key: 'prefetch' },
340
272
  { name: 'getCachePathAsync', argumentsCount: 1, key: 'getCachePathAsync' },
341
- { name: 'prefetch', argumentsCount: 2, key: 'prefetch' },
273
+ { name: 'startAnimating', argumentsCount: 0, key: 'startAnimating' },
274
+ { name: 'stopAnimating', argumentsCount: 0, key: 'stopAnimating' },
342
275
  ],
343
276
  ExpoImageManipulator: [
344
277
  { name: 'manipulateAsync', argumentsCount: 3, key: 'manipulateAsync' },
@@ -412,10 +345,8 @@ module.exports = {
412
345
  { name: 'getAlbumAsync', argumentsCount: 1, key: 14 },
413
346
  ],
414
347
  ExponentAccelerometer: [
415
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
416
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
417
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
418
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
348
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
349
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
419
350
  ],
420
351
  ExponentAV: [
421
352
  { name: 'getStatusForVideo', argumentsCount: 1, key: 0 },
@@ -442,44 +373,65 @@ module.exports = {
442
373
  { name: 'getCurrentInput', argumentsCount: 0, key: 21 },
443
374
  { name: 'startAudioRecording', argumentsCount: 0, key: 22 },
444
375
  ],
445
- ExponentConstants: [
446
- { name: 'getWebViewUserAgentAsync', argumentsCount: 0, key: 'getWebViewUserAgentAsync' },
447
- ],
448
- ExponentDeviceMotion: [
449
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
450
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
451
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
452
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
453
- ],
454
- ExponentFileSystem: [
455
- { name: 'copyAsync', argumentsCount: 1, key: 'copyAsync' },
456
- { name: 'deleteAsync', argumentsCount: 2, key: 'deleteAsync' },
457
- { name: 'downloadAsync', argumentsCount: 3, key: 'downloadAsync' },
376
+ ExpoCamera: [
377
+ { name: 'getAvailablePictureSizes', argumentsCount: 2, key: 'getAvailablePictureSizes' },
458
378
  {
459
- name: 'downloadResumablePauseAsync',
460
- argumentsCount: 1,
461
- key: 'downloadResumablePauseAsync',
379
+ name: 'getAvailableVideoCodecsAsync',
380
+ argumentsCount: 0,
381
+ key: 'getAvailableVideoCodecsAsync',
462
382
  },
463
383
  {
464
- name: 'downloadResumableStartAsync',
465
- argumentsCount: 5,
466
- key: 'downloadResumableStartAsync',
384
+ name: 'getCameraPermissionsAsync',
385
+ argumentsCount: 0,
386
+ key: 'getCameraPermissionsAsync',
467
387
  },
468
- { name: 'getFreeDiskStorageAsync', argumentsCount: 0, key: 'getFreeDiskStorageAsync' },
469
- { name: 'getInfoAsync', argumentsCount: 2, key: 'getInfoAsync' },
470
388
  {
471
- name: 'getTotalDiskCapacityAsync',
389
+ name: 'getMicrophonePermissionsAsync',
472
390
  argumentsCount: 0,
473
- key: 'getTotalDiskCapacityAsync',
391
+ key: 'getMicrophonePermissionsAsync',
392
+ },
393
+ { name: 'getPermissionsAsync', argumentsCount: 0, key: 'getPermissionsAsync' },
394
+ { name: 'pausePreview', argumentsCount: 1, key: 'pausePreview' },
395
+ { name: 'record', argumentsCount: 2, key: 'record' },
396
+ {
397
+ name: 'requestCameraPermissionsAsync',
398
+ argumentsCount: 0,
399
+ key: 'requestCameraPermissionsAsync',
474
400
  },
475
- { name: 'makeDirectoryAsync', argumentsCount: 2, key: 'makeDirectoryAsync' },
476
- { name: 'moveAsync', argumentsCount: 1, key: 'moveAsync' },
477
- { name: 'networkTaskCancelAsync', argumentsCount: 1, key: 'networkTaskCancelAsync' },
478
- { name: 'readAsStringAsync', argumentsCount: 2, key: 'readAsStringAsync' },
479
- { name: 'readDirectoryAsync', argumentsCount: 1, key: 'readDirectoryAsync' },
480
- { name: 'uploadAsync', argumentsCount: 3, key: 'uploadAsync' },
481
- { name: 'uploadTaskStartAsync', argumentsCount: 4, key: 'uploadTaskStartAsync' },
482
- { name: 'writeAsStringAsync', argumentsCount: 3, key: 'writeAsStringAsync' },
401
+ {
402
+ name: 'requestMicrophonePermissionsAsync',
403
+ argumentsCount: 0,
404
+ key: 'requestMicrophonePermissionsAsync',
405
+ },
406
+ { name: 'requestPermissionsAsync', argumentsCount: 0, key: 'requestPermissionsAsync' },
407
+ { name: 'resumePreview', argumentsCount: 1, key: 'resumePreview' },
408
+ { name: 'stopRecording', argumentsCount: 1, key: 'stopRecording' },
409
+ { name: 'takePicture', argumentsCount: 2, key: 'takePicture' },
410
+ ],
411
+ ExponentConstants: [
412
+ { name: 'getWebViewUserAgentAsync', argumentsCount: 0, key: 'getWebViewUserAgentAsync' },
413
+ ],
414
+ ExponentDeviceMotion: [
415
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
416
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
417
+ ],
418
+ ExponentFileSystem: [
419
+ { name: 'uploadAsync', argumentsCount: 3, key: 0 },
420
+ { name: 'readDirectoryAsync', argumentsCount: 1, key: 1 },
421
+ { name: 'getTotalDiskCapacityAsync', argumentsCount: 0, key: 2 },
422
+ { name: 'getInfoAsync', argumentsCount: 2, key: 3 },
423
+ { name: 'downloadAsync', argumentsCount: 3, key: 4 },
424
+ { name: 'writeAsStringAsync', argumentsCount: 3, key: 5 },
425
+ { name: 'deleteAsync', argumentsCount: 2, key: 6 },
426
+ { name: 'moveAsync', argumentsCount: 1, key: 7 },
427
+ { name: 'getFreeDiskStorageAsync', argumentsCount: 0, key: 8 },
428
+ { name: 'readAsStringAsync', argumentsCount: 2, key: 9 },
429
+ { name: 'downloadResumableStartAsync', argumentsCount: 5, key: 10 },
430
+ { name: 'makeDirectoryAsync', argumentsCount: 2, key: 11 },
431
+ { name: 'uploadTaskStartAsync', argumentsCount: 4, key: 12 },
432
+ { name: 'copyAsync', argumentsCount: 1, key: 13 },
433
+ { name: 'networkTaskCancelAsync', argumentsCount: 1, key: 14 },
434
+ { name: 'downloadResumablePauseAsync', argumentsCount: 1, key: 15 },
483
435
  ],
484
436
  ExponentGLObjectManager: [
485
437
  { name: 'createContextAsync', argumentsCount: 0, key: 0 },
@@ -490,10 +442,8 @@ module.exports = {
490
442
  ],
491
443
  ExponentGLView: [],
492
444
  ExponentGyroscope: [
493
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
494
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
495
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
496
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
445
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
446
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
497
447
  ],
498
448
  ExponentImagePicker: [
499
449
  {
@@ -520,24 +470,18 @@ module.exports = {
520
470
  },
521
471
  ],
522
472
  ExponentMagnetometer: [
523
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
524
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
525
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
526
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
473
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
474
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
527
475
  ],
528
476
  ExponentMagnetometerUncalibrated: [
529
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
530
- { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
531
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
532
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
477
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 0 },
478
+ { name: 'setUpdateInterval', argumentsCount: 1, key: 1 },
533
479
  ],
534
480
  ExponentPedometer: [
535
- { name: 'getPermissionsAsync', argumentsCount: 0, key: 'getPermissionsAsync' },
536
- { name: 'getStepCountAsync', argumentsCount: 2, key: 'getStepCountAsync' },
537
- { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
538
- { name: 'requestPermissionsAsync', argumentsCount: 0, key: 'requestPermissionsAsync' },
539
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
540
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
481
+ { name: 'requestPermissionsAsync', argumentsCount: 0, key: 0 },
482
+ { name: 'getPermissionsAsync', argumentsCount: 0, key: 1 },
483
+ { name: 'isAvailableAsync', argumentsCount: 0, key: 2 },
484
+ { name: 'getStepCountAsync', argumentsCount: 2, key: 3 },
541
485
  ],
542
486
  ExpoNetwork: [
543
487
  { name: 'getIpAddressAsync', argumentsCount: 0, key: 'getIpAddressAsync' },
@@ -571,6 +515,10 @@ module.exports = {
571
515
  ExpoNotificationsHandlerModule: [
572
516
  { name: 'handleNotificationAsync', argumentsCount: 2, key: 0 },
573
517
  ],
518
+ ExpoPermissions: [
519
+ { name: 'getAsync', argumentsCount: 1, key: 0 },
520
+ { name: 'askAsync', argumentsCount: 1, key: 1 },
521
+ ],
574
522
  ExpoPrint: [
575
523
  { name: 'print', argumentsCount: 1, key: 'print' },
576
524
  { name: 'printToFileAsync', argumentsCount: 1, key: 'printToFileAsync' },
@@ -634,16 +582,9 @@ module.exports = {
634
582
  ],
635
583
  ExpoSQLite: [
636
584
  { name: 'close', argumentsCount: 1, key: 'close' },
637
- { name: 'closeSync', argumentsCount: 1, key: 'closeSync' },
638
585
  { name: 'deleteAsync', argumentsCount: 1, key: 'deleteAsync' },
639
586
  { name: 'exec', argumentsCount: 3, key: 'exec' },
640
587
  ],
641
- ExpoSQLiteNext: [
642
- { name: 'deleteDatabaseAsync', argumentsCount: 1, key: 'deleteDatabaseAsync' },
643
- { name: 'deleteDatabaseSync', argumentsCount: 1, key: 'deleteDatabaseSync' },
644
- { name: 'startObserving', argumentsCount: 0, key: 'startObserving' },
645
- { name: 'stopObserving', argumentsCount: 0, key: 'stopObserving' },
646
- ],
647
588
  ExpoStoreReview: [
648
589
  { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
649
590
  { name: 'requestReview', argumentsCount: 0, key: 'requestReview' },
@@ -662,7 +603,6 @@ module.exports = {
662
603
  { name: 'getRegisteredTasksAsync', argumentsCount: 0, key: 6 },
663
604
  ],
664
605
  ExpoTrackingTransparency: [
665
- { name: 'getAdvertisingId', argumentsCount: 0, key: 'getAdvertisingId' },
666
606
  { name: 'getPermissionsAsync', argumentsCount: 0, key: 'getPermissionsAsync' },
667
607
  { name: 'requestPermissionsAsync', argumentsCount: 0, key: 'requestPermissionsAsync' },
668
608
  ],
@@ -671,16 +611,10 @@ module.exports = {
671
611
  { name: 'clearLogEntriesAsync', argumentsCount: 0, key: 'clearLogEntriesAsync' },
672
612
  { name: 'fetchUpdateAsync', argumentsCount: 0, key: 'fetchUpdateAsync' },
673
613
  { name: 'getExtraParamsAsync', argumentsCount: 0, key: 'getExtraParamsAsync' },
674
- {
675
- name: 'getNativeStateMachineContextAsync',
676
- argumentsCount: 0,
677
- key: 'getNativeStateMachineContextAsync',
678
- },
679
614
  { name: 'readLogEntriesAsync', argumentsCount: 1, key: 'readLogEntriesAsync' },
680
615
  { name: 'reload', argumentsCount: 0, key: 'reload' },
681
616
  { name: 'setExtraParamAsync', argumentsCount: 2, key: 'setExtraParamAsync' },
682
617
  ],
683
- ExpoVideo: [],
684
618
  ExpoVideoThumbnails: [{ name: 'getThumbnail', argumentsCount: 2, key: 'getThumbnail' }],
685
619
  ExpoVideoView: [{ name: 'setFullscreen', argumentsCount: 2, key: 'setFullscreen' }],
686
620
  ExpoWebBrowser: [
@@ -717,22 +651,10 @@ module.exports = {
717
651
  nativeApplicationVersion: { type: 'string' },
718
652
  nativeBuildVersion: { type: 'string' },
719
653
  },
720
- ExpoBackgroundFetch: {},
721
654
  ExpoBarCodeScanner: { BarCodeType: { type: 'object' }, Type: { type: 'object' } },
722
- ExpoBarometer: {},
723
655
  ExpoBattery: { isSupported: { type: 'boolean', mock: false } },
724
656
  ExpoBlurView: {},
725
657
  ExpoBrightness: {},
726
- ExpoCamera: {
727
- AutoFocus: { type: 'object' },
728
- FlashMode: { type: 'object' },
729
- Type: { type: 'object' },
730
- VideoCodec: { type: 'object' },
731
- VideoQuality: { type: 'object' },
732
- VideoStabilization: { type: 'object' },
733
- WhiteBalance: { type: 'object' },
734
- },
735
- ExpoCameraNext: {},
736
658
  ExpoCellular: {
737
659
  allowsVoip: { type: 'object', mock: null },
738
660
  carrier: { type: 'object', mock: null },
@@ -745,7 +667,7 @@ module.exports = {
745
667
  brand: { type: 'string' },
746
668
  deviceName: { type: 'string' },
747
669
  deviceType: { type: 'number', mock: 1 },
748
- deviceYearClass: { type: 'number', mock: 2024 },
670
+ deviceYearClass: { type: 'number', mock: 2023 },
749
671
  isDevice: { type: 'boolean', mock: false },
750
672
  manufacturer: { type: 'string' },
751
673
  modelId: { type: 'string' },
@@ -755,15 +677,13 @@ module.exports = {
755
677
  osName: { type: 'string' },
756
678
  osVersion: { type: 'string' },
757
679
  supportedCpuArchitectures: { type: 'array' },
758
- totalMemory: { type: 'number', mock: 34359738368 },
680
+ totalMemory: { type: 'number', mock: 17179869184 },
759
681
  },
760
682
  ExpoDocumentPicker: {},
761
- ExpoGo: { expoVersion: { type: 'string' }, projectConfig: { type: 'object' } },
762
683
  ExpoFontLoader: {
763
684
  customNativeFonts: { type: 'array' },
764
685
  },
765
686
  ExpoHaptics: {},
766
- ExpoHead: { activities: { type: 'object' } },
767
687
  ExpoImage: {},
768
688
  ExpoImageManipulator: {},
769
689
  ExpoKeepAwake: {},
@@ -787,11 +707,20 @@ module.exports = {
787
707
  MediaType: { type: 'object' },
788
708
  SortBy: { type: 'object' },
789
709
  },
790
- ExponentAccelerometer: {},
791
710
  ExponentAV: { Qualities: { type: 'object' } },
711
+ ExpoCamera: {
712
+ AutoFocus: { type: 'object' },
713
+ FlashMode: { type: 'object' },
714
+ Type: { type: 'object' },
715
+ VideoCodec: { type: 'object' },
716
+ VideoQuality: { type: 'object' },
717
+ VideoStabilization: { type: 'object' },
718
+ WhiteBalance: { type: 'object' },
719
+ },
792
720
  ExponentConstants: {
721
+ AppOwnership: { type: 'object' },
793
722
  appOwnership: { type: 'string' },
794
- debugMode: { type: 'boolean', mock: true },
723
+ debugMode: { type: 'boolean', mock: false },
795
724
  deviceName: { type: 'string' },
796
725
  executionEnvironment: { type: 'string' },
797
726
  experienceUrl: { type: 'string' },
@@ -811,18 +740,14 @@ module.exports = {
811
740
  supportedExpoSdks: { type: 'array' },
812
741
  systemFonts: { type: 'array' },
813
742
  },
814
- ExponentDeviceMotion: { Gravity: { type: 'number', mock: 9.80665 } },
743
+ ExponentDeviceMotion: { Gravity: { type: 'number', mock: 9.8100004196167 } },
815
744
  ExponentFileSystem: {
816
- bundleDirectory: { type: 'string' },
745
+ bundleDirectory: { type: 'object', mock: null },
817
746
  cacheDirectory: { type: 'string' },
818
747
  documentDirectory: { type: 'string' },
819
748
  },
820
749
  ExponentGLView: {},
821
- ExponentGyroscope: {},
822
750
  ExponentImagePicker: {},
823
- ExponentMagnetometer: {},
824
- ExponentMagnetometerUncalibrated: {},
825
- ExponentPedometer: {},
826
751
  ExpoNetwork: {},
827
752
  ExpoPrint: { Orientation: { type: 'object' } },
828
753
  ExpoRandom: {},
@@ -834,13 +759,12 @@ module.exports = {
834
759
  ALWAYS_THIS_DEVICE_ONLY: { type: 'number', mock: 4 },
835
760
  WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: { type: 'number', mock: 3 },
836
761
  WHEN_UNLOCKED: { type: 'number', mock: 5 },
837
- WHEN_UNLOCKED_THIS_DEVICE_ONLY: { type: 'number', mock: 6 },
762
+ WHEN_UNLOCKED_THIS_DEVICE_ONLY: { type: 'number', mock: 3 },
838
763
  },
839
764
  ExpoSharing: {},
840
765
  ExpoSMS: {},
841
766
  ExpoSpeech: {},
842
767
  ExpoSQLite: {},
843
- ExpoSQLiteNext: {},
844
768
  ExpoStoreReview: {},
845
769
  ExpoSystemUI: {},
846
770
  ExpoTaskManager: { EVENT_NAME: { type: 'string' } },
@@ -854,7 +778,6 @@ module.exports = {
854
778
  releaseChannel: { type: 'string' },
855
779
  runtimeVersion: { type: 'string' },
856
780
  },
857
- ExpoVideo: {},
858
781
  ExpoVideoThumbnails: {},
859
782
  ExpoVideoView: {
860
783
  ScaleAspectFill: { type: 'string' },
@@ -871,52 +794,10 @@ module.exports = {
871
794
  ExpoAppleAuthentication: { propsNames: ['buttonStyle', 'buttonType', 'cornerRadius'] },
872
795
  ExpoBarCodeScanner: { propsNames: ['barCodeTypes', 'type'] },
873
796
  ExpoBlurView: { propsNames: ['intensity', 'tint'] },
874
- ExpoCamera: {
875
- propsNames: [
876
- 'autoFocus',
877
- 'barCodeScannerEnabled',
878
- 'barCodeScannerSettings',
879
- 'faceDetectorEnabled',
880
- 'faceDetectorSettings',
881
- 'flashMode',
882
- 'focusDepth',
883
- 'pictureSize',
884
- 'responsiveOrientationWhenOrientationLocked',
885
- 'type',
886
- 'whiteBalance',
887
- 'zoom',
888
- ],
889
- },
890
- ExpoCameraNext: {
891
- propsNames: [
892
- 'barcodeScannerEnabled',
893
- 'barcodeScannerSettings',
894
- 'enableTorch',
895
- 'flashMode',
896
- 'mode',
897
- 'mute',
898
- 'responsiveOrientationWhenOrientationLocked',
899
- 'type',
900
- 'videoQuality',
901
- 'zoom',
902
- ],
903
- },
904
- ExpoClipboard: {
905
- propsNames: [
906
- 'acceptedContentTypes',
907
- 'backgroundColor',
908
- 'cornerStyle',
909
- 'displayMode',
910
- 'foregroundColor',
911
- 'imageOptions',
912
- ],
913
- },
914
797
  ExpoImage: {
915
798
  propsNames: [
916
799
  'accessibilityLabel',
917
800
  'accessible',
918
- 'allowDownscaling',
919
- 'autoplay',
920
801
  'blurRadius',
921
802
  'cachePolicy',
922
803
  'contentFit',
@@ -932,18 +813,23 @@ module.exports = {
932
813
  ],
933
814
  },
934
815
  ExpoLinearGradient: { propsNames: ['colors', 'endPoint', 'locations', 'startPoint'] },
935
- ExponentGLView: { propsNames: ['enableExperimentalWorkletSupport', 'msaaSamples'] },
936
- ExpoVideo: {
816
+ ExpoCamera: {
937
817
  propsNames: [
938
- 'allowsFullscreen',
939
- 'contentFit',
940
- 'contentPosition',
941
- 'nativeControls',
942
- 'player',
943
- 'requiresLinearPlayback',
944
- 'showsTimecodes',
818
+ 'autoFocus',
819
+ 'barCodeScannerEnabled',
820
+ 'barCodeScannerSettings',
821
+ 'faceDetectorEnabled',
822
+ 'faceDetectorSettings',
823
+ 'flashMode',
824
+ 'focusDepth',
825
+ 'pictureSize',
826
+ 'responsiveOrientationWhenOrientationLocked',
827
+ 'type',
828
+ 'whiteBalance',
829
+ 'zoom',
945
830
  ],
946
831
  },
832
+ ExponentGLView: { propsNames: ['enableExperimentalWorkletSupport', 'msaaSamples'] },
947
833
  ExpoVideoView: { propsNames: ['resizeMode', 'source', 'status', 'useNativeControls'] },
948
834
  },
949
835
  },
@@ -960,6 +846,64 @@ module.exports = {
960
846
  getConstants: { type: 'function' },
961
847
  getRandomBase64: { type: 'function', functionType: 'sync' },
962
848
  },
849
+ RNBranch: {
850
+ createUniversalObject: { type: 'function', functionType: 'promise' },
851
+ disableTracking: { type: 'function', functionType: 'async' },
852
+ generateShortUrl: { type: 'function', functionType: 'promise' },
853
+ getConstants: { type: 'function' },
854
+ getCreditHistory: { type: 'function', functionType: 'promise' },
855
+ getFirstReferringParams: { type: 'function', functionType: 'promise' },
856
+ getLatestReferringParams: { type: 'function', functionType: 'promise' },
857
+ getShortUrl: { type: 'function', functionType: 'promise' },
858
+ INIT_SESSION_ERROR: { type: 'string' },
859
+ INIT_SESSION_START: { type: 'string' },
860
+ INIT_SESSION_SUCCESS: { type: 'string' },
861
+ initializeBranch: { type: 'function', functionType: 'promise' },
862
+ isTrackingDisabled: { type: 'function', functionType: 'promise' },
863
+ listOnSpotlight: { type: 'function', functionType: 'promise' },
864
+ loadRewards: { type: 'function', functionType: 'promise' },
865
+ logEvent: { type: 'function', functionType: 'promise' },
866
+ logout: { type: 'function', functionType: 'async' },
867
+ openURL: { type: 'function', functionType: 'async' },
868
+ redeemInitSessionResult: { type: 'function', functionType: 'promise' },
869
+ redeemRewards: { type: 'function', functionType: 'promise' },
870
+ registerView: { type: 'function', functionType: 'promise' },
871
+ releaseUniversalObject: { type: 'function', functionType: 'async' },
872
+ sendCommerceEvent: { type: 'function', functionType: 'promise' },
873
+ setIdentity: { type: 'function', functionType: 'async' },
874
+ setRequestMetadataKey: { type: 'function', functionType: 'async' },
875
+ showShareSheet: { type: 'function', functionType: 'promise' },
876
+ STANDARD_EVENT_ACHIEVE_LEVEL: { type: 'string' },
877
+ STANDARD_EVENT_ADD_PAYMENT_INFO: { type: 'string' },
878
+ STANDARD_EVENT_ADD_TO_CART: { type: 'string' },
879
+ STANDARD_EVENT_ADD_TO_WISHLIST: { type: 'string' },
880
+ STANDARD_EVENT_CLICK_AD: { type: 'string' },
881
+ STANDARD_EVENT_COMPLETE_REGISTRATION: { type: 'string' },
882
+ STANDARD_EVENT_COMPLETE_TUTORIAL: { type: 'string' },
883
+ STANDARD_EVENT_INITIATE_PURCHASE: { type: 'string' },
884
+ STANDARD_EVENT_INVITE: { type: 'string' },
885
+ STANDARD_EVENT_LOGIN: { type: 'string' },
886
+ STANDARD_EVENT_PURCHASE: { type: 'string' },
887
+ STANDARD_EVENT_RATE: { type: 'string' },
888
+ STANDARD_EVENT_RESERVE: { type: 'string' },
889
+ STANDARD_EVENT_SEARCH: { type: 'string' },
890
+ STANDARD_EVENT_SHARE: { type: 'string' },
891
+ STANDARD_EVENT_SPEND_CREDITS: { type: 'string' },
892
+ STANDARD_EVENT_START_TRIAL: { type: 'string' },
893
+ STANDARD_EVENT_SUBSCRIBE: { type: 'string' },
894
+ STANDARD_EVENT_UNLOCK_ACHIEVEMENT: { type: 'string' },
895
+ STANDARD_EVENT_VIEW_AD: { type: 'string' },
896
+ STANDARD_EVENT_VIEW_CART: { type: 'string' },
897
+ STANDARD_EVENT_VIEW_ITEM: { type: 'string' },
898
+ STANDARD_EVENT_VIEW_ITEMS: { type: 'string' },
899
+ userCompletedAction: { type: 'function', functionType: 'async' },
900
+ userCompletedActionOnUniversalObject: { type: 'function', functionType: 'promise' },
901
+ },
902
+ RNBranchEventEmitter: {
903
+ addListener: { type: 'function', functionType: 'async' },
904
+ getConstants: { type: 'function' },
905
+ removeListeners: { type: 'function', functionType: 'async' },
906
+ },
963
907
  RNCMaskedViewManager: {},
964
908
  RNCNetInfo: {
965
909
  addListener: { type: 'function', functionType: 'async' },
@@ -968,7 +912,6 @@ module.exports = {
968
912
  getCurrentState: { type: 'function', functionType: 'promise' },
969
913
  removeListeners: { type: 'function', functionType: 'async' },
970
914
  },
971
- RNCPickerManager: {},
972
915
  RNCSafeAreaContext: {
973
916
  getConstants: { type: 'function' },
974
917
  initialWindowMetrics: { type: 'object' },
@@ -981,10 +924,9 @@ module.exports = {
981
924
  getConstants: { type: 'function' },
982
925
  setPage: { type: 'function', functionType: 'async' },
983
926
  setPageWithoutAnimation: { type: 'function', functionType: 'async' },
984
- setScrollEnabledImperatively: { type: 'function', functionType: 'async' },
927
+ setScrollEnabled: { type: 'function', functionType: 'async' },
985
928
  },
986
929
  RNCWebView: {
987
- clearCache: { type: 'function', functionType: 'async' },
988
930
  getConstants: { type: 'function' },
989
931
  goBack: { type: 'function', functionType: 'async' },
990
932
  goForward: { type: 'function', functionType: 'async' },
@@ -1012,7 +954,7 @@ module.exports = {
1012
954
  updateGestureHandler: { type: 'function', functionType: 'async' },
1013
955
  },
1014
956
  RNSFullWindowOverlayManager: {},
1015
- RNSkiaModule: {
957
+ RNSkia: {
1016
958
  getConstants: { type: 'function' },
1017
959
  install: { type: 'function', functionType: 'sync' },
1018
960
  },
@@ -182,6 +182,19 @@ jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
182
182
  },
183
183
  }));
184
184
 
185
+ // Mock the `createSnapshotFriendlyRef` to return an ref that can be serialized in snapshots.
186
+ jest.doMock('expo-modules-core/build/Refs', () => ({
187
+ createSnapshotFriendlyRef: () => {
188
+ const { createSnapshotFriendlyRef } = jest.requireActual('expo-modules-core/build/Refs');
189
+ // Fixes: `cannot define property "toJSON", object is not extensible
190
+ const ref = Object.create(createSnapshotFriendlyRef());
191
+ Object.defineProperty(ref, 'toJSON', {
192
+ value: () => '[React.ref]',
193
+ });
194
+ return ref;
195
+ },
196
+ }));
197
+
185
198
  function attemptLookup(moduleName) {
186
199
  // hack to get the package name from the module name
187
200
  const filePath = stackTrace.getSync().find((line) => line.fileName.includes(moduleName));
@@ -229,6 +242,31 @@ try {
229
242
  }
230
243
  return {
231
244
  ...ExpoModulesCore,
245
+ // Mock EventEmitter since it's commonly constructed in modules and causing warnings.
246
+ EventEmitter: jest.fn().mockImplementation(() => {
247
+ const fbemitter = require('fbemitter');
248
+ const emitter = new fbemitter.EventEmitter();
249
+ return {
250
+ addListener: jest.fn().mockImplementation((...args) => {
251
+ const subscription = emitter.addListener(...args);
252
+ subscription.__remove = subscription.remove;
253
+ return subscription;
254
+ }),
255
+ removeAllListeners: jest.fn().mockImplementation((...args) => {
256
+ emitter.removeAllListeners(...args);
257
+ }),
258
+ removeSubscription: jest.fn().mockImplementation((subscription) => {
259
+ // expo-sensor will override the `subscription.remove()` method,
260
+ // to prevent it from recursive call. we need to call the original remove method.
261
+ if (typeof subscription.__remove === 'function') {
262
+ subscription.__remove();
263
+ }
264
+ }),
265
+ emit: jest.fn().mockImplementation((...args) => {
266
+ emitter.emit(...args);
267
+ }),
268
+ };
269
+ }),
232
270
  requireNativeModule: (name) => {
233
271
  // Support auto-mocking of expo-modules that:
234
272
  // 1. have a mock in the `mocks` directory