jest-expo 50.0.0-alpha.3 → 50.0.0-canary-20231123-1b19f96
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 +7 -0
- package/package.json +4 -4
- package/src/preset/expoModules.js +6 -4
- package/src/preset/setup.js +8 -1
package/jest-preset.js
CHANGED
|
@@ -7,6 +7,13 @@ const jestPreset = cloneDeep(require('react-native/jest-preset'));
|
|
|
7
7
|
|
|
8
8
|
const { withTypescriptMapping } = require('./src/preset/withTypescriptMapping');
|
|
9
9
|
|
|
10
|
+
// Emulate the alias behavior of Expo's Metro resolver.
|
|
11
|
+
jestPreset.moduleNameMapper = {
|
|
12
|
+
...(jestPreset.moduleNameMapper || {}),
|
|
13
|
+
'^react-native-vector-icons$': '@expo/vector-icons',
|
|
14
|
+
'^react-native-vector-icons/(.*)': '@expo/vector-icons/$1',
|
|
15
|
+
};
|
|
16
|
+
|
|
10
17
|
// transform
|
|
11
18
|
if (!jestPreset.transform) {
|
|
12
19
|
jestPreset.transform = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-expo",
|
|
3
|
-
"version": "50.0.0-
|
|
3
|
+
"version": "50.0.0-canary-20231123-1b19f96",
|
|
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": "0.0.0-canary-20231123-1b19f96-1",
|
|
35
|
+
"@expo/json-file": "0.0.0-canary-20231123-1b19f96",
|
|
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": "1b19f96bd0e50f43e4329e388347423e7cce20b6"
|
|
52
52
|
}
|
|
@@ -269,6 +269,9 @@ module.exports = {
|
|
|
269
269
|
{ name: 'clearDiskCache', argumentsCount: 0, key: 'clearDiskCache' },
|
|
270
270
|
{ name: 'clearMemoryCache', argumentsCount: 0, key: 'clearMemoryCache' },
|
|
271
271
|
{ name: 'prefetch', argumentsCount: 1, key: 'prefetch' },
|
|
272
|
+
{ name: 'getCachePathAsync', argumentsCount: 1, key: 'getCachePathAsync' },
|
|
273
|
+
{ name: 'startAnimating', argumentsCount: 0, key: 'startAnimating' },
|
|
274
|
+
{ name: 'stopAnimating', argumentsCount: 0, key: 'stopAnimating' },
|
|
272
275
|
],
|
|
273
276
|
ExpoImageManipulator: [
|
|
274
277
|
{ name: 'manipulateAsync', argumentsCount: 3, key: 'manipulateAsync' },
|
|
@@ -370,7 +373,7 @@ module.exports = {
|
|
|
370
373
|
{ name: 'getCurrentInput', argumentsCount: 0, key: 21 },
|
|
371
374
|
{ name: 'startAudioRecording', argumentsCount: 0, key: 22 },
|
|
372
375
|
],
|
|
373
|
-
|
|
376
|
+
ExpoCamera: [
|
|
374
377
|
{ name: 'getAvailablePictureSizes', argumentsCount: 2, key: 'getAvailablePictureSizes' },
|
|
375
378
|
{
|
|
376
379
|
name: 'getAvailableVideoCodecsAsync',
|
|
@@ -702,7 +705,7 @@ module.exports = {
|
|
|
702
705
|
SortBy: { type: 'object' },
|
|
703
706
|
},
|
|
704
707
|
ExponentAV: { Qualities: { type: 'object' } },
|
|
705
|
-
|
|
708
|
+
ExpoCamera: {
|
|
706
709
|
AutoFocus: { type: 'object' },
|
|
707
710
|
FlashMode: { type: 'object' },
|
|
708
711
|
Type: { type: 'object' },
|
|
@@ -735,7 +738,6 @@ module.exports = {
|
|
|
735
738
|
},
|
|
736
739
|
ExponentDeviceMotion: { Gravity: { type: 'number', mock: 9.8100004196167 } },
|
|
737
740
|
ExponentFileSystem: {
|
|
738
|
-
bundledAssets: { type: 'object', mock: null },
|
|
739
741
|
bundleDirectory: { type: 'object', mock: null },
|
|
740
742
|
cacheDirectory: { type: 'string' },
|
|
741
743
|
documentDirectory: { type: 'string' },
|
|
@@ -807,7 +809,7 @@ module.exports = {
|
|
|
807
809
|
],
|
|
808
810
|
},
|
|
809
811
|
ExpoLinearGradient: { propsNames: ['colors', 'endPoint', 'locations', 'startPoint'] },
|
|
810
|
-
|
|
812
|
+
ExpoCamera: {
|
|
811
813
|
propsNames: [
|
|
812
814
|
'autoFocus',
|
|
813
815
|
'barCodeScannerEnabled',
|
package/src/preset/setup.js
CHANGED
|
@@ -40,6 +40,10 @@ const expoModules = {
|
|
|
40
40
|
...internalExpoModules,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
// Mock the experience URL in development mode for asset setup
|
|
44
|
+
expoModules.NativeUnimoduleProxy.modulesConstants.mockDefinition.ExponentConstants.experienceUrl.mock =
|
|
45
|
+
'exp://192.168.1.200:8081';
|
|
46
|
+
|
|
43
47
|
function mock(property, customMock) {
|
|
44
48
|
const propertyType = property.type;
|
|
45
49
|
let mockValue;
|
|
@@ -128,7 +132,7 @@ try {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
jest.mock('react-native/
|
|
135
|
+
jest.mock('@react-native/assets-registry/registry', () => ({
|
|
132
136
|
registerAsset: jest.fn(() => 1),
|
|
133
137
|
getAssetByID: jest.fn(() => ({
|
|
134
138
|
fileSystemLocation: '/full/path/to/directory',
|
|
@@ -234,3 +238,6 @@ try {
|
|
|
234
238
|
throw error;
|
|
235
239
|
}
|
|
236
240
|
}
|
|
241
|
+
|
|
242
|
+
// Ensure the environment globals are installed before the first test runs.
|
|
243
|
+
require('expo/build/winter');
|