jest-expo 43.0.0 → 44.0.1
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/README.md +7 -8
- package/jest-preset.js +1 -1
- package/package.json +3 -4
- package/src/preset/assetFileTransformer.js +1 -1
- package/src/preset/expoModules.js +43 -19
package/README.md
CHANGED
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
A [Jest](https://facebook.github.io/jest/) preset to painlessly test your Expo / React Native apps.
|
|
4
4
|
|
|
5
|
-
If you have problems with the code in this repository, please file issues & bug reports
|
|
6
|
-
at https://github.com/expo/expo. Thanks!
|
|
7
|
-
|
|
8
5
|
### Installation
|
|
9
6
|
|
|
10
|
-
-
|
|
7
|
+
- To install the compatible version of `jest-expo` and `jest` for your project, run: `expo install jest-expo jest`.
|
|
11
8
|
- Add the following config to `package.json`:
|
|
12
9
|
|
|
13
|
-
```
|
|
10
|
+
```json
|
|
14
11
|
"scripts": {
|
|
15
|
-
|
|
16
|
-
"test
|
|
12
|
+
...
|
|
13
|
+
"test": "jest"
|
|
17
14
|
},
|
|
18
15
|
"jest": {
|
|
19
16
|
"preset": "jest-expo"
|
|
@@ -30,6 +27,8 @@ at https://github.com/expo/expo. Thanks!
|
|
|
30
27
|
|
|
31
28
|
- Run `npm test` and it should pass
|
|
32
29
|
|
|
30
|
+
> You can use a different version of `jest` than the one that is installed with `expo install`, but keep in mind that the SDK and `jest-expo` are built against that version.
|
|
31
|
+
|
|
33
32
|
## Platforms
|
|
34
33
|
|
|
35
34
|
You can use `jest-expo` to test any Expo supported platform. For legacy purposes `jest-expo` runs your tests in the standard React Native environment (iOS).
|
|
@@ -116,4 +115,4 @@ Alternative to `jest-expo/node`. This runs in a Node environment for testing **S
|
|
|
116
115
|
|
|
117
116
|
### Learning Jest
|
|
118
117
|
|
|
119
|
-
[Read the
|
|
118
|
+
[Read the Jest documentation](https://facebook.github.io/jest/)
|
package/jest-preset.js
CHANGED
|
@@ -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)
|
|
41
|
+
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|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": "
|
|
3
|
+
"version": "44.0.1",
|
|
4
4
|
"description": "A Jest preset to painlessly test your Expo / React Native apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src",
|
|
@@ -31,11 +31,10 @@
|
|
|
31
31
|
"preset": "jest-expo/universal"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@expo/config": "^
|
|
34
|
+
"@expo/config": "^6.0.6",
|
|
35
35
|
"@jest/create-cache-key-function": "^26.6.2",
|
|
36
36
|
"babel-jest": "^26.6.3",
|
|
37
37
|
"find-up": "^5.0.0",
|
|
38
|
-
"jest": "^26.6.3",
|
|
39
38
|
"jest-watch-select-projects": "^2.0.0",
|
|
40
39
|
"jest-watch-typeahead": "0.6.4",
|
|
41
40
|
"json5": "^2.1.0",
|
|
@@ -46,5 +45,5 @@
|
|
|
46
45
|
"url": "https://github.com/expo/expo/issues"
|
|
47
46
|
},
|
|
48
47
|
"homepage": "https://github.com/expo/expo/tree/master/packages/jest-expo",
|
|
49
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2c6354c1b6ef276bf8e1a8afae086f648d4fdf5c"
|
|
50
49
|
}
|
|
@@ -83,6 +83,7 @@ module.exports = {
|
|
|
83
83
|
getRandomBase64String: { type: 'function', functionType: 'sync' },
|
|
84
84
|
getRandomBase64StringAsync: { type: 'function', functionType: 'promise' },
|
|
85
85
|
},
|
|
86
|
+
ExponentAV: { Qualities: { type: 'object' }, getConstants: { type: 'function' } },
|
|
86
87
|
ExponentNotifications: {
|
|
87
88
|
cancelAllScheduledNotificationsAsync: { type: 'function', functionType: 'promise' },
|
|
88
89
|
cancelScheduledNotificationAsync: { type: 'function', functionType: 'promise' },
|
|
@@ -224,7 +225,7 @@ module.exports = {
|
|
|
224
225
|
{ key: 1, argumentsCount: 0, name: 'isLowPowerModeEnabledAsync' },
|
|
225
226
|
{ key: 2, argumentsCount: 0, name: 'getBatteryStateAsync' },
|
|
226
227
|
],
|
|
227
|
-
ExpoBlurViewManager: [{ key: 0, argumentsCount: 2, name: '
|
|
228
|
+
ExpoBlurViewManager: [{ key: 0, argumentsCount: 2, name: 'setNativeProps' }],
|
|
228
229
|
ExpoBrightness: [
|
|
229
230
|
{ key: 0, argumentsCount: 0, name: 'getPermissionsAsync' },
|
|
230
231
|
{ key: 1, argumentsCount: 0, name: 'getSystemBrightnessAsync' },
|
|
@@ -259,28 +260,30 @@ module.exports = {
|
|
|
259
260
|
{ key: 18, argumentsCount: 1, name: 'getSourceByIdAsync' },
|
|
260
261
|
],
|
|
261
262
|
ExpoCellular: [
|
|
262
|
-
{
|
|
263
|
+
{ key: 'allowsVoipAsync', argumentsCount: 0, name: 'allowsVoipAsync' },
|
|
263
264
|
{
|
|
264
265
|
name: 'getCellularGenerationAsync',
|
|
265
266
|
argumentsCount: 0,
|
|
266
267
|
key: 'getCellularGenerationAsync',
|
|
267
268
|
},
|
|
268
|
-
{ name: 'allowsVoipAsync', key: 'allowsVoipAsync', argumentsCount: 0 },
|
|
269
|
-
{ argumentsCount: 0, key: 'getCarrierNameAsync', name: 'getCarrierNameAsync' },
|
|
270
269
|
{
|
|
271
|
-
name: '
|
|
272
|
-
key: 'getMobileCountryCodeAsync',
|
|
270
|
+
name: 'getMobileNetworkCodeAsync',
|
|
273
271
|
argumentsCount: 0,
|
|
272
|
+
key: 'getMobileNetworkCodeAsync',
|
|
274
273
|
},
|
|
274
|
+
{ name: 'getCarrierNameAsync', key: 'getCarrierNameAsync', argumentsCount: 0 },
|
|
275
275
|
{
|
|
276
|
+
key: 'getMobileCountryCodeAsync',
|
|
276
277
|
argumentsCount: 0,
|
|
277
|
-
name: '
|
|
278
|
-
key: 'getMobileNetworkCodeAsync',
|
|
278
|
+
name: 'getMobileCountryCodeAsync',
|
|
279
279
|
},
|
|
280
|
+
{ key: 'getIsoCountryCodeAsync', name: 'getIsoCountryCodeAsync', argumentsCount: 0 },
|
|
280
281
|
],
|
|
281
282
|
ExpoClipboard: [
|
|
282
|
-
{ key:
|
|
283
|
-
{
|
|
283
|
+
{ key: 'startObserving', name: 'startObserving', argumentsCount: 0 },
|
|
284
|
+
{ argumentsCount: 0, key: 'getStringAsync', name: 'getStringAsync' },
|
|
285
|
+
{ key: 'setString', name: 'setString', argumentsCount: 1 },
|
|
286
|
+
{ argumentsCount: 0, name: 'stopObserving', key: 'stopObserving' },
|
|
284
287
|
],
|
|
285
288
|
ExpoContacts: [
|
|
286
289
|
{ key: 0, argumentsCount: 0, name: 'getDefaultContainerIdentifierAsync' },
|
|
@@ -314,10 +317,11 @@ module.exports = {
|
|
|
314
317
|
ExpoFirebaseAnalytics: [
|
|
315
318
|
{ key: 0, argumentsCount: 2, name: 'logEvent' },
|
|
316
319
|
{ key: 1, argumentsCount: 1, name: 'setUserId' },
|
|
317
|
-
{ key: 2, argumentsCount:
|
|
320
|
+
{ key: 2, argumentsCount: 0, name: 'resetAnalyticsData' },
|
|
318
321
|
{ key: 3, argumentsCount: 2, name: 'setCurrentScreen' },
|
|
319
|
-
{ key: 4, argumentsCount:
|
|
320
|
-
{ key: 5, argumentsCount: 1, name: '
|
|
322
|
+
{ key: 4, argumentsCount: 1, name: 'setUserProperties' },
|
|
323
|
+
{ key: 5, argumentsCount: 1, name: 'setSessionTimeoutDuration' },
|
|
324
|
+
{ key: 6, argumentsCount: 1, name: 'setAnalyticsCollectionEnabled' },
|
|
321
325
|
],
|
|
322
326
|
ExpoFirebaseCore: [],
|
|
323
327
|
ExpoFontLoader: [{ key: 0, argumentsCount: 2, name: 'loadAsync' }],
|
|
@@ -333,16 +337,16 @@ module.exports = {
|
|
|
333
337
|
{ key: 8, argumentsCount: 0, name: 'isConnectedAsync' },
|
|
334
338
|
],
|
|
335
339
|
ExpoHaptics: [
|
|
336
|
-
{
|
|
337
|
-
{ name: 'impactAsync', key: 'impactAsync', argumentsCount: 1 },
|
|
340
|
+
{ argumentsCount: 1, name: 'impactAsync', key: 'impactAsync' },
|
|
338
341
|
{ key: 'selectionAsync', name: 'selectionAsync', argumentsCount: 0 },
|
|
342
|
+
{ key: 'notificationAsync', name: 'notificationAsync', argumentsCount: 1 },
|
|
339
343
|
],
|
|
340
344
|
ExpoImageManipulator: [{ key: 0, argumentsCount: 3, name: 'manipulateAsync' }],
|
|
341
345
|
ExpoKeepAwake: [
|
|
342
346
|
{ key: 0, argumentsCount: 1, name: 'activate' },
|
|
343
347
|
{ key: 1, argumentsCount: 1, name: 'deactivate' },
|
|
344
348
|
],
|
|
345
|
-
|
|
349
|
+
ExpoLinearGradient: [],
|
|
346
350
|
ExpoLocalAuthentication: [
|
|
347
351
|
{ key: 0, argumentsCount: 0, name: 'supportedAuthenticationTypesAsync' },
|
|
348
352
|
{ key: 1, argumentsCount: 0, name: 'isEnrolledAsync' },
|
|
@@ -350,7 +354,9 @@ module.exports = {
|
|
|
350
354
|
{ key: 3, argumentsCount: 0, name: 'hasHardwareAsync' },
|
|
351
355
|
{ key: 4, argumentsCount: 1, name: 'authenticateAsync' },
|
|
352
356
|
],
|
|
353
|
-
ExpoLocalization: [
|
|
357
|
+
ExpoLocalization: [
|
|
358
|
+
{ argumentsCount: 0, key: 'getLocalizationAsync', name: 'getLocalizationAsync' },
|
|
359
|
+
],
|
|
354
360
|
ExpoLocation: [
|
|
355
361
|
{ key: 0, argumentsCount: 2, name: 'watchPositionImplAsync' },
|
|
356
362
|
{ key: 1, argumentsCount: 1, name: 'watchDeviceHeading' },
|
|
@@ -446,6 +452,10 @@ module.exports = {
|
|
|
446
452
|
{ key: 0, argumentsCount: 0, name: 'isAvailableAsync' },
|
|
447
453
|
{ key: 1, argumentsCount: 0, name: 'requestReview' },
|
|
448
454
|
],
|
|
455
|
+
ExpoSystemUI: [
|
|
456
|
+
{ name: 'setBackgroundColorAsync', argumentsCount: 1, key: 'setBackgroundColorAsync' },
|
|
457
|
+
{ argumentsCount: 0, name: 'getBackgroundColorAsync', key: 'getBackgroundColorAsync' },
|
|
458
|
+
],
|
|
449
459
|
ExpoTaskManager: [
|
|
450
460
|
{ key: 0, argumentsCount: 0, name: 'isAvailableAsync' },
|
|
451
461
|
{ key: 1, argumentsCount: 2, name: 'notifyTaskFinishedAsync' },
|
|
@@ -456,8 +466,8 @@ module.exports = {
|
|
|
456
466
|
{ key: 6, argumentsCount: 0, name: 'getRegisteredTasksAsync' },
|
|
457
467
|
],
|
|
458
468
|
ExpoTrackingTransparency: [
|
|
459
|
-
{
|
|
460
|
-
{ argumentsCount: 0,
|
|
469
|
+
{ name: 'requestPermissionsAsync', key: 'requestPermissionsAsync', argumentsCount: 0 },
|
|
470
|
+
{ argumentsCount: 0, name: 'getPermissionsAsync', key: 'getPermissionsAsync' },
|
|
461
471
|
],
|
|
462
472
|
ExpoUpdates: [
|
|
463
473
|
{ key: 0, argumentsCount: 0, name: 'checkForUpdateAsync' },
|
|
@@ -723,6 +733,14 @@ module.exports = {
|
|
|
723
733
|
mobileNetworkCode: { type: 'object', mock: null },
|
|
724
734
|
removeListeners: { type: 'function' },
|
|
725
735
|
},
|
|
736
|
+
ExpoClipboard: {
|
|
737
|
+
addListener: { type: 'function' },
|
|
738
|
+
getStringAsync: { type: 'function' },
|
|
739
|
+
removeListeners: { type: 'function' },
|
|
740
|
+
setString: { type: 'function' },
|
|
741
|
+
startObserving: { type: 'function' },
|
|
742
|
+
stopObserving: { type: 'function' },
|
|
743
|
+
},
|
|
726
744
|
ExpoDevice: {
|
|
727
745
|
addListener: { type: 'function' },
|
|
728
746
|
brand: { type: 'string' },
|
|
@@ -817,6 +835,12 @@ module.exports = {
|
|
|
817
835
|
removeListeners: { type: 'function' },
|
|
818
836
|
setValueWithKeyAsync: { type: 'function' },
|
|
819
837
|
},
|
|
838
|
+
ExpoSystemUI: {
|
|
839
|
+
addListener: { type: 'function' },
|
|
840
|
+
getBackgroundColorAsync: { type: 'function' },
|
|
841
|
+
removeListeners: { type: 'function' },
|
|
842
|
+
setBackgroundColorAsync: { type: 'function' },
|
|
843
|
+
},
|
|
820
844
|
ExpoTaskManager: {
|
|
821
845
|
EVENT_NAME: { type: 'string' },
|
|
822
846
|
addListener: { type: 'function' },
|