jest-expo 53.0.0-canary-20250306-d9d3e02 → 53.0.0-canary-20250331-817737a
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 +5 -7
- package/src/index.js +6 -9
- package/src/preset/setup.js +19 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-expo",
|
|
3
|
-
"version": "53.0.0-canary-
|
|
3
|
+
"version": "53.0.0-canary-20250331-817737a",
|
|
4
4
|
"description": "A Jest preset to painlessly test your Expo / React Native apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -37,12 +37,11 @@
|
|
|
37
37
|
"preset": "jest-expo/universal"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@expo/config": "11.0.0-canary-
|
|
41
|
-
"@expo/json-file": "9.0.3-canary-
|
|
40
|
+
"@expo/config": "11.0.0-canary-20250331-817737a",
|
|
41
|
+
"@expo/json-file": "9.0.3-canary-20250331-817737a",
|
|
42
42
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
43
43
|
"@jest/globals": "^29.2.1",
|
|
44
44
|
"babel-jest": "^29.2.1",
|
|
45
|
-
"fbemitter": "^3.0.0",
|
|
46
45
|
"find-up": "^5.0.0",
|
|
47
46
|
"jest-environment-jsdom": "^29.2.1",
|
|
48
47
|
"jest-snapshot": "^29.2.1",
|
|
@@ -56,8 +55,7 @@
|
|
|
56
55
|
"stacktrace-js": "^2.0.2"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
|
-
"expo": "53.0.0-canary-
|
|
58
|
+
"expo": "53.0.0-canary-20250331-817737a",
|
|
60
59
|
"react-native": "*"
|
|
61
|
-
}
|
|
62
|
-
"gitHead": "d9d3e024d8742099c307754673f17117a20c1dea"
|
|
60
|
+
}
|
|
63
61
|
}
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EventEmitter } from 'fbemitter';
|
|
2
1
|
import { Linking } from 'react-native';
|
|
3
2
|
|
|
4
3
|
const allOriginalPropertyDescriptors = new Map();
|
|
@@ -60,17 +59,15 @@ export function unmockAllProperties() {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
export function mockLinking() {
|
|
63
|
-
const
|
|
64
|
-
const subscriptions = {};
|
|
62
|
+
const listeners = Object.create(null);
|
|
65
63
|
|
|
66
64
|
mockProperty(
|
|
67
65
|
Linking,
|
|
68
66
|
'addEventListener',
|
|
69
67
|
jest.fn((type, cb) => {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return subscription;
|
|
68
|
+
const listenersForType = listeners[type] || (listeners[type] = new Set());
|
|
69
|
+
listenersForType.add(cb);
|
|
70
|
+
return { remove: () => listenersForType.delete(cb) };
|
|
74
71
|
})
|
|
75
72
|
);
|
|
76
73
|
|
|
@@ -78,11 +75,11 @@ export function mockLinking() {
|
|
|
78
75
|
Linking,
|
|
79
76
|
'removeEventListener',
|
|
80
77
|
jest.fn((type, cb) => {
|
|
81
|
-
|
|
78
|
+
listeners[type]?.delete(cb);
|
|
82
79
|
})
|
|
83
80
|
);
|
|
84
81
|
|
|
85
82
|
return (type, data) => {
|
|
86
|
-
|
|
83
|
+
listeners[type]?.forEach((listener) => listener(data));
|
|
87
84
|
};
|
|
88
85
|
}
|
package/src/preset/setup.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
const findUp = require('find-up');
|
|
8
8
|
const path = require('path');
|
|
9
|
-
const mockNativeModules = require('react-native/Libraries/BatchedBridge/NativeModules');
|
|
9
|
+
const mockNativeModules = require('react-native/Libraries/BatchedBridge/NativeModules').default;
|
|
10
10
|
const stackTrace = require('stacktrace-js');
|
|
11
11
|
|
|
12
12
|
const publicExpoModules = require('./expoModules');
|
|
@@ -165,20 +165,26 @@ jest.mock('@react-native/assets-registry/registry', () => ({
|
|
|
165
165
|
})),
|
|
166
166
|
}));
|
|
167
167
|
|
|
168
|
-
jest.doMock('react-native/Libraries/BatchedBridge/NativeModules', () =>
|
|
168
|
+
jest.doMock('react-native/Libraries/BatchedBridge/NativeModules', () => ({
|
|
169
|
+
__esModule: true,
|
|
170
|
+
default: mockNativeModules,
|
|
171
|
+
}));
|
|
169
172
|
|
|
170
173
|
jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
__esModule: true,
|
|
175
|
+
default: {
|
|
176
|
+
ignoreLogs: (patterns) => {
|
|
177
|
+
// Do nothing.
|
|
178
|
+
},
|
|
179
|
+
ignoreAllLogs: (value) => {
|
|
180
|
+
// Do nothing.
|
|
181
|
+
},
|
|
182
|
+
install: () => {
|
|
183
|
+
// Do nothing.
|
|
184
|
+
},
|
|
185
|
+
uninstall: () => {
|
|
186
|
+
// Do nothing.
|
|
187
|
+
},
|
|
182
188
|
},
|
|
183
189
|
}));
|
|
184
190
|
|