jest-expo 42.0.1 → 43.0.0

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/jest-preset.js CHANGED
@@ -28,7 +28,7 @@ if (!Array.isArray(jestPreset.transformIgnorePatterns)) {
28
28
  console.warn(`Expected react-native/jest-preset to define a transformIgnorePatterns array`);
29
29
  } else if (
30
30
  !isEqual(jestPreset.transformIgnorePatterns, [
31
- 'node_modules/(?!(jest-)?react-native|@react-native-community)',
31
+ 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
32
32
  ])
33
33
  ) {
34
34
  console.warn(
@@ -38,7 +38,7 @@ if (!Array.isArray(jestPreset.transformIgnorePatterns)) {
38
38
 
39
39
  // Also please keep `testing-with-jest.md` file up to date
40
40
  jestPreset.transformIgnorePatterns = [
41
- 'node_modules/(?!(jest-)?react-native|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
41
+ 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
42
42
  ];
43
43
 
44
44
  // setupFiles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "42.0.1",
3
+ "version": "43.0.0",
4
4
  "description": "A Jest preset to painlessly test your Expo / React Native apps.",
5
5
  "license": "MIT",
6
6
  "main": "src",
@@ -31,19 +31,20 @@
31
31
  "preset": "jest-expo/universal"
32
32
  },
33
33
  "dependencies": {
34
- "@expo/config": "^5.0.3",
35
- "babel-jest": "^25.2.0",
34
+ "@expo/config": "^5.0.9",
35
+ "@jest/create-cache-key-function": "^26.6.2",
36
+ "babel-jest": "^26.6.3",
36
37
  "find-up": "^5.0.0",
37
- "jest": "^25.2.0",
38
+ "jest": "^26.6.3",
38
39
  "jest-watch-select-projects": "^2.0.0",
39
- "jest-watch-typeahead": "^0.5.0",
40
+ "jest-watch-typeahead": "0.6.4",
40
41
  "json5": "^2.1.0",
41
- "lodash": "^4.5.0",
42
- "react-test-renderer": "~16.11.0"
42
+ "lodash": "^4.17.19",
43
+ "react-test-renderer": "~17.0.1"
43
44
  },
44
45
  "bugs": {
45
46
  "url": "https://github.com/expo/expo/issues"
46
47
  },
47
48
  "homepage": "https://github.com/expo/expo/tree/master/packages/jest-expo",
48
- "gitHead": "c2fe33c58a80fe4b0e2498e5075c86f533ffaa19"
49
+ "gitHead": "4fa0497a180ae707fa860cb03858630ab7af19f4"
49
50
  }
@@ -1,4 +1,4 @@
1
- const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
1
+ const createCacheKeyFunction = require('@jest/create-cache-key-function');
2
2
 
3
3
  module.exports = {
4
4
  process: (_, filename) => `module.exports = 1;`,
@@ -52,6 +52,7 @@ module.exports = {
52
52
  fitToCoordinates: { type: 'function', functionType: 'async' },
53
53
  fitToElements: { type: 'function', functionType: 'async' },
54
54
  fitToSuppliedMarkers: { type: 'function', functionType: 'async' },
55
+ getAddressFromCoordinates: { type: 'function', functionType: 'promise' },
55
56
  getCamera: { type: 'function', functionType: 'promise' },
56
57
  getConstants: { type: 'function' },
57
58
  getMapBoundaries: { type: 'function', functionType: 'promise' },
@@ -71,6 +72,7 @@ module.exports = {
71
72
  AIRMapPolylineManager: {},
72
73
  AIRMapUrlTileManager: {},
73
74
  AIRMapWMSTileManager: {},
75
+ 'ExpoModulesCore.ViewModuleWrapper': {},
74
76
  ExpoNativeModuleIntrospection: {
75
77
  getConstants: { type: 'function' },
76
78
  getNativeModuleNamesAsync: { type: 'function', functionType: 'promise' },
@@ -199,6 +201,10 @@ module.exports = {
199
201
  { key: 2, argumentsCount: 0, name: 'getStatusAsync' },
200
202
  { key: 3, argumentsCount: 2, name: 'registerTaskAsync' },
201
203
  ],
204
+ ExpoBackgroundNotificationTasksModule: [
205
+ { key: 0, argumentsCount: 1, name: 'unregisterTaskAsync' },
206
+ { key: 1, argumentsCount: 1, name: 'registerTaskAsync' },
207
+ ],
202
208
  ExpoBadgeModule: [
203
209
  { key: 0, argumentsCount: 1, name: 'setBadgeCountAsync' },
204
210
  { key: 1, argumentsCount: 0, name: 'getBadgeCountAsync' },
@@ -252,7 +258,26 @@ module.exports = {
252
258
  { key: 17, argumentsCount: 1, name: 'saveReminderAsync' },
253
259
  { key: 18, argumentsCount: 1, name: 'getSourceByIdAsync' },
254
260
  ],
255
- ExpoCellular: [{ key: 0, argumentsCount: 0, name: 'getCellularGenerationAsync' }],
261
+ ExpoCellular: [
262
+ { name: 'getIsoCountryCodeAsync', argumentsCount: 0, key: 'getIsoCountryCodeAsync' },
263
+ {
264
+ name: 'getCellularGenerationAsync',
265
+ argumentsCount: 0,
266
+ key: 'getCellularGenerationAsync',
267
+ },
268
+ { name: 'allowsVoipAsync', key: 'allowsVoipAsync', argumentsCount: 0 },
269
+ { argumentsCount: 0, key: 'getCarrierNameAsync', name: 'getCarrierNameAsync' },
270
+ {
271
+ name: 'getMobileCountryCodeAsync',
272
+ key: 'getMobileCountryCodeAsync',
273
+ argumentsCount: 0,
274
+ },
275
+ {
276
+ argumentsCount: 0,
277
+ name: 'getMobileNetworkCodeAsync',
278
+ key: 'getMobileNetworkCodeAsync',
279
+ },
280
+ ],
256
281
  ExpoClipboard: [
257
282
  { key: 0, argumentsCount: 0, name: 'getStringAsync' },
258
283
  { key: 1, argumentsCount: 1, name: 'setString' },
@@ -308,9 +333,9 @@ module.exports = {
308
333
  { key: 8, argumentsCount: 0, name: 'isConnectedAsync' },
309
334
  ],
310
335
  ExpoHaptics: [
311
- { key: 0, argumentsCount: 0, name: 'selectionAsync' },
312
- { key: 1, argumentsCount: 1, name: 'notificationAsync' },
313
- { key: 2, argumentsCount: 1, name: 'impactAsync' },
336
+ { key: 'notificationAsync', argumentsCount: 1, name: 'notificationAsync' },
337
+ { name: 'impactAsync', key: 'impactAsync', argumentsCount: 1 },
338
+ { key: 'selectionAsync', name: 'selectionAsync', argumentsCount: 0 },
314
339
  ],
315
340
  ExpoImageManipulator: [{ key: 0, argumentsCount: 3, name: 'manipulateAsync' }],
316
341
  ExpoKeepAwake: [
@@ -431,8 +456,8 @@ module.exports = {
431
456
  { key: 6, argumentsCount: 0, name: 'getRegisteredTasksAsync' },
432
457
  ],
433
458
  ExpoTrackingTransparency: [
434
- { key: 0, argumentsCount: 0, name: 'getPermissionsAsync' },
435
- { key: 1, argumentsCount: 0, name: 'requestPermissionsAsync' },
459
+ { argumentsCount: 0, name: 'requestPermissionsAsync', key: 'requestPermissionsAsync' },
460
+ { argumentsCount: 0, key: 'getPermissionsAsync', name: 'getPermissionsAsync' },
436
461
  ],
437
462
  ExpoUpdates: [
438
463
  { key: 0, argumentsCount: 0, name: 'checkForUpdateAsync' },
@@ -531,8 +556,10 @@ module.exports = {
531
556
  { key: 9, argumentsCount: 2, name: 'readAsStringAsync' },
532
557
  { key: 10, argumentsCount: 5, name: 'downloadResumableStartAsync' },
533
558
  { key: 11, argumentsCount: 2, name: 'makeDirectoryAsync' },
534
- { key: 12, argumentsCount: 1, name: 'copyAsync' },
535
- { key: 13, argumentsCount: 1, name: 'downloadResumablePauseAsync' },
559
+ { key: 12, argumentsCount: 4, name: 'uploadTaskStartAsync' },
560
+ { key: 13, argumentsCount: 1, name: 'copyAsync' },
561
+ { key: 14, argumentsCount: 1, name: 'networkTaskCancelAsync' },
562
+ { key: 15, argumentsCount: 1, name: 'downloadResumablePauseAsync' },
536
563
  ],
537
564
  ExponentGLObjectManager: [
538
565
  { key: 0, argumentsCount: 0, name: 'createContextAsync' },
@@ -683,8 +710,14 @@ module.exports = {
683
710
  ExpoCellular: {
684
711
  addListener: { type: 'function' },
685
712
  allowsVoip: { type: 'boolean', mock: true },
686
- carrier: { type: 'object', mock: null },
713
+ allowsVoipAsync: { type: 'function' },
714
+ carrier: { type: 'string' },
715
+ generation: { type: 'number', mock: 0 },
716
+ getCarrierNameAsync: { type: 'function' },
687
717
  getCellularGenerationAsync: { type: 'function' },
718
+ getIsoCountryCodeAsync: { type: 'function' },
719
+ getMobileCountryCodeAsync: { type: 'function' },
720
+ getMobileNetworkCodeAsync: { type: 'function' },
688
721
  isoCountryCode: { type: 'object', mock: null },
689
722
  mobileCountryCode: { type: 'object', mock: null },
690
723
  mobileNetworkCode: { type: 'object', mock: null },
@@ -694,7 +727,7 @@ module.exports = {
694
727
  addListener: { type: 'function' },
695
728
  brand: { type: 'string' },
696
729
  deviceName: { type: 'string' },
697
- deviceYearClass: { type: 'number', mock: 2019 },
730
+ deviceYearClass: { type: 'number', mock: 2020 },
698
731
  getDeviceTypeAsync: { type: 'function' },
699
732
  getUptimeAsync: { type: 'function' },
700
733
  isDevice: { type: 'boolean', mock: true },
@@ -707,7 +740,7 @@ module.exports = {
707
740
  osVersion: { type: 'string' },
708
741
  removeListeners: { type: 'function' },
709
742
  supportedCpuArchitectures: { type: 'array' },
710
- totalMemory: { type: 'number', mock: 4030169088 },
743
+ totalMemory: { type: 'number', mock: 3108814848 },
711
744
  },
712
745
  ExpoErrorRecovery: {
713
746
  addListener: { type: 'function' },
@@ -744,13 +777,24 @@ module.exports = {
744
777
  signInSilentlyAsync: { type: 'function' },
745
778
  signOutAsync: { type: 'function' },
746
779
  },
780
+ ExpoHaptics: {
781
+ addListener: { type: 'function' },
782
+ impactAsync: { type: 'function' },
783
+ notificationAsync: { type: 'function' },
784
+ removeListeners: { type: 'function' },
785
+ selectionAsync: { type: 'function' },
786
+ },
787
+ ExpoLinearGradient: {
788
+ addListener: { type: 'function' },
789
+ removeListeners: { type: 'function' },
790
+ },
747
791
  ExpoLocalization: {
748
792
  addListener: { type: 'function' },
749
793
  currency: { type: 'string' },
750
794
  decimalSeparator: { type: 'string' },
751
795
  digitGroupingSeparator: { type: 'string' },
752
796
  getLocalizationAsync: { type: 'function' },
753
- isMetric: { type: 'boolean', mock: false },
797
+ isMetric: { type: 'boolean', mock: true },
754
798
  isRTL: { type: 'boolean', mock: false },
755
799
  isoCurrencyCodes: { type: 'array' },
756
800
  locale: { type: 'string' },
@@ -785,6 +829,12 @@ module.exports = {
785
829
  unregisterAllTasksAsync: { type: 'function' },
786
830
  unregisterTaskAsync: { type: 'function' },
787
831
  },
832
+ ExpoTrackingTransparency: {
833
+ addListener: { type: 'function' },
834
+ getPermissionsAsync: { type: 'function' },
835
+ removeListeners: { type: 'function' },
836
+ requestPermissionsAsync: { type: 'function' },
837
+ },
788
838
  ExpoUpdates: {
789
839
  addListener: { type: 'function' },
790
840
  checkForUpdateAsync: { type: 'function' },
@@ -857,8 +907,8 @@ module.exports = {
857
907
  appOwnership: { type: 'string' },
858
908
  debugMode: { type: 'boolean', mock: true },
859
909
  deviceName: { type: 'string' },
860
- deviceYearClass: { type: 'number', mock: 2019 },
861
- executionEnvironment: { type: 'string', mock: 'standalone' },
910
+ deviceYearClass: { type: 'number', mock: 2021 },
911
+ executionEnvironment: { type: 'string' },
862
912
  experienceUrl: { type: 'string' },
863
913
  expoRuntimeVersion: { type: 'string' },
864
914
  expoVersion: { type: 'string' },
@@ -874,7 +924,7 @@ module.exports = {
874
924
  platform: { type: 'object' },
875
925
  removeListeners: { type: 'function' },
876
926
  sessionId: { type: 'string' },
877
- statusBarHeight: { type: 'number', mock: 44 },
927
+ statusBarHeight: { type: 'number', mock: 20 },
878
928
  supportedExpoSdks: { type: 'array' },
879
929
  systemFonts: { type: 'array' },
880
930
  },
@@ -901,10 +951,12 @@ module.exports = {
901
951
  getTotalDiskCapacityAsync: { type: 'function' },
902
952
  makeDirectoryAsync: { type: 'function' },
903
953
  moveAsync: { type: 'function' },
954
+ networkTaskCancelAsync: { type: 'function' },
904
955
  readAsStringAsync: { type: 'function' },
905
956
  readDirectoryAsync: { type: 'function' },
906
957
  removeListeners: { type: 'function' },
907
958
  uploadAsync: { type: 'function' },
959
+ uploadTaskStartAsync: { type: 'function' },
908
960
  writeAsStringAsync: { type: 'function' },
909
961
  },
910
962
  ExponentMediaLibrary: {
@@ -971,6 +1023,7 @@ module.exports = {
971
1023
  computeModPow: { type: 'function', functionType: 'async' },
972
1024
  computeS: { type: 'function', functionType: 'async' },
973
1025
  getConstants: { type: 'function' },
1026
+ getRandomBase64: { type: 'function', functionType: 'sync' },
974
1027
  },
975
1028
  RNBranch: {
976
1029
  INIT_SESSION_ERROR: { type: 'string' },
@@ -1086,8 +1139,10 @@ module.exports = {
1086
1139
  removeListeners: { type: 'function', functionType: 'async' },
1087
1140
  updateGestureHandler: { type: 'function', functionType: 'async' },
1088
1141
  },
1142
+ RNSFullWindowOverlayManager: {},
1089
1143
  RNSScreenContainerManager: {},
1090
1144
  RNSScreenManager: {},
1145
+ RNSScreenNavigationContainerManager: {},
1091
1146
  RNSScreenStackHeaderConfigManager: {},
1092
1147
  RNSScreenStackHeaderSubviewManager: {},
1093
1148
  RNSScreenStackManager: {},
@@ -95,7 +95,7 @@ for (const moduleName of Object.keys(expoModules)) {
95
95
  });
96
96
  }
97
97
 
98
- mockNativeModules.NativeUnimoduleProxy.viewManagersNames.forEach(viewManagerName => {
98
+ mockNativeModules.NativeUnimoduleProxy.viewManagersNames.forEach((viewManagerName) => {
99
99
  Object.defineProperty(mockNativeModules.UIManager, `ViewManagerAdapter_${viewManagerName}`, {
100
100
  get: () => ({
101
101
  NativeProps: {},
@@ -153,10 +153,10 @@ jest.mock('react-native/Libraries/Image/AssetRegistry', () => ({
153
153
  jest.doMock('react-native/Libraries/BatchedBridge/NativeModules', () => mockNativeModules);
154
154
 
155
155
  jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
156
- ignoreLogs: patterns => {
156
+ ignoreLogs: (patterns) => {
157
157
  // Do nothing.
158
158
  },
159
- ignoreAllLogs: value => {
159
+ ignoreAllLogs: (value) => {
160
160
  // Do nothing.
161
161
  },
162
162
  install: () => {
@@ -168,9 +168,9 @@ jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
168
168
  }));
169
169
 
170
170
  try {
171
- jest.mock('@unimodules/react-native-adapter', () => {
172
- const ReactNativeAdapter = jest.requireActual('@unimodules/react-native-adapter');
173
- const { NativeModulesProxy } = ReactNativeAdapter;
171
+ jest.mock('expo-modules-core', () => {
172
+ const ExpoModulesCore = jest.requireActual('expo-modules-core');
173
+ const { NativeModulesProxy } = ExpoModulesCore;
174
174
 
175
175
  // After the NativeModules mock is set up, we can mock NativeModuleProxy's functions that call
176
176
  // into the native proxy module. We're not really interested in checking whether the underlying
@@ -188,7 +188,7 @@ try {
188
188
  }
189
189
  }
190
190
 
191
- return ReactNativeAdapter;
191
+ return ExpoModulesCore;
192
192
  });
193
193
  } catch (error) {
194
194
  // Allow this module to be optional for bare-workflow
@@ -1,9 +1,9 @@
1
1
  const path = require('path');
2
2
 
3
3
  const testDirectory = `__tests__`;
4
- module.exports = platform => {
4
+ module.exports = (platform) => {
5
5
  const customPath = path.join(testDirectory, '__snapshots__');
6
- const getExt = ext => `${ext}.${platform}`;
6
+ const getExt = (ext) => `${ext}.${platform}`;
7
7
  return {
8
8
  resolveSnapshotPath: (testPath, snapshotExtension) => {
9
9
  const snapshotFilePath =