jest-expo 55.0.0-canary-20260119-17896bf → 55.0.0-canary-20260120-bb71700
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/config/getPlatformPreset.js +0 -8
- package/package.json +5 -5
- package/src/filePath.js +9 -0
- package/src/preset/moduleMocks/expoModules.js +8 -4
- package/src/preset/setup.js +19 -1
- package/src/preset/withTypescriptMapping.js +3 -1
- package/src/rsc-utils.js +7 -3
- package/config/react-canaries-resolver.js +0 -18
|
@@ -91,14 +91,6 @@ function getPlatformPreset(displayOptions, extensions, platform, { isServer, isR
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (isReactServer) {
|
|
94
|
-
try {
|
|
95
|
-
// This will throw if React isn't the right version.
|
|
96
|
-
require('react-server-dom-webpack/server');
|
|
97
|
-
} catch {
|
|
98
|
-
// Use a resolver which redirects to the canaries directory for React and React DOM.
|
|
99
|
-
preset.resolver = require.resolve('./react-canaries-resolver');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
94
|
preset.testEnvironment = 'node';
|
|
103
95
|
if (!preset.setupFiles) {
|
|
104
96
|
preset.setupFiles = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-expo",
|
|
3
|
-
"version": "55.0.0-canary-
|
|
3
|
+
"version": "55.0.0-canary-20260120-bb71700",
|
|
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,8 +37,8 @@
|
|
|
37
37
|
"preset": "jest-expo/universal"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@expo/config": "12.0.14-canary-
|
|
41
|
-
"@expo/json-file": "10.0.9-canary-
|
|
40
|
+
"@expo/config": "12.0.14-canary-20260120-bb71700",
|
|
41
|
+
"@expo/json-file": "10.0.9-canary-20260120-bb71700",
|
|
42
42
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
43
43
|
"@jest/globals": "^29.2.1",
|
|
44
44
|
"babel-jest": "^29.2.1",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"jest-watch-typeahead": "2.2.1",
|
|
49
49
|
"json5": "^2.2.3",
|
|
50
50
|
"lodash": "^4.17.19",
|
|
51
|
-
"react-test-renderer": "19.
|
|
51
|
+
"react-test-renderer": "19.2.0",
|
|
52
52
|
"server-only": "^0.0.1",
|
|
53
53
|
"stacktrace-js": "^2.0.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"expo": "55.0.0-canary-
|
|
56
|
+
"expo": "55.0.0-canary-20260120-bb71700",
|
|
57
57
|
"react-native": "*",
|
|
58
58
|
"react-server-dom-webpack": "~19.0.3 || ~19.1.4 || ~19.2.3"
|
|
59
59
|
},
|
package/src/filePath.js
ADDED
|
@@ -100,7 +100,6 @@ module.exports = {
|
|
|
100
100
|
argumentsCount: 0,
|
|
101
101
|
key: 'setSystemBrightnessModeAsync',
|
|
102
102
|
},
|
|
103
|
-
{ name: 'useSystemBrightnessAsync', argumentsCount: 0, key: 'useSystemBrightnessAsync' },
|
|
104
103
|
],
|
|
105
104
|
ExpoCalendar: [
|
|
106
105
|
{
|
|
@@ -436,7 +435,7 @@ module.exports = {
|
|
|
436
435
|
{ name: 'uploadTaskStartAsync', argumentsCount: 4, key: 'uploadTaskStartAsync' },
|
|
437
436
|
{ name: 'writeAsStringAsync', argumentsCount: 3, key: 'writeAsStringAsync' },
|
|
438
437
|
],
|
|
439
|
-
|
|
438
|
+
ExpoGL: [],
|
|
440
439
|
ExponentGyroscope: [
|
|
441
440
|
{ name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
|
|
442
441
|
{ name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
|
|
@@ -569,6 +568,7 @@ module.exports = {
|
|
|
569
568
|
},
|
|
570
569
|
],
|
|
571
570
|
ExpoRouterNativeLinkPreview: [],
|
|
571
|
+
ExpoRouter: [],
|
|
572
572
|
ExpoScreenCapture: [
|
|
573
573
|
{ name: 'allowScreenCapture', argumentsCount: 0, key: 'allowScreenCapture' },
|
|
574
574
|
{
|
|
@@ -1112,7 +1112,7 @@ module.exports = {
|
|
|
1112
1112
|
uploadTaskStartAsync: { type: 'function' },
|
|
1113
1113
|
writeAsStringAsync: { type: 'function' },
|
|
1114
1114
|
},
|
|
1115
|
-
|
|
1115
|
+
ExpoGL: {
|
|
1116
1116
|
addListener: { type: 'function' },
|
|
1117
1117
|
removeListeners: { type: 'function' },
|
|
1118
1118
|
},
|
|
@@ -1212,6 +1212,10 @@ module.exports = {
|
|
|
1212
1212
|
removeListeners: { type: 'function' },
|
|
1213
1213
|
unregisterForNotificationsAsync: { type: 'function' },
|
|
1214
1214
|
},
|
|
1215
|
+
ExpoRouter: {
|
|
1216
|
+
Material3Color: { type: 'function' },
|
|
1217
|
+
Material3DynamicColor: { type: 'function' },
|
|
1218
|
+
},
|
|
1215
1219
|
ExpoRouterNativeLinkPreview: {
|
|
1216
1220
|
addListener: { type: 'function' },
|
|
1217
1221
|
removeListeners: { type: 'function' },
|
|
@@ -1450,7 +1454,7 @@ module.exports = {
|
|
|
1450
1454
|
ExpoLivePhoto: {
|
|
1451
1455
|
propNames: ['contentFit', 'isMuted', 'source', 'useDefaultGestureRecognizer'],
|
|
1452
1456
|
},
|
|
1453
|
-
|
|
1457
|
+
ExpoGL: { propNames: ['enableExperimentalWorkletSupport', 'msaaSamples'] },
|
|
1454
1458
|
ExpoRouterNativeLinkPreview: {
|
|
1455
1459
|
propNames: [
|
|
1456
1460
|
'destructive',
|
package/src/preset/setup.js
CHANGED
|
@@ -192,7 +192,25 @@ jest.doMock('react-native/Libraries/LogBox/LogBox', () => ({
|
|
|
192
192
|
|
|
193
193
|
function attemptLookup(moduleName) {
|
|
194
194
|
// hack to get the package name from the module name
|
|
195
|
-
const filePath = stackTrace.getSync().find((line) =>
|
|
195
|
+
const filePath = stackTrace.getSync().find((line) => {
|
|
196
|
+
if (line.fileName.includes(moduleName)) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!fs.existsSync(line.fileName)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
const fileContents = fs.readFileSync(line.fileName, { encoding: 'utf8' });
|
|
204
|
+
// Matches requireNativeModule<OptionalGeneric>("ModuleName")
|
|
205
|
+
const regexPattern = new RegExp(
|
|
206
|
+
`require(?:Optional)?NativeModule\\s*(?:<${moduleName}Module>)?\\s*\\(['"]${moduleName}['"]\\)`
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
if (regexPattern.test(fileContents)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
});
|
|
196
214
|
if (!filePath) {
|
|
197
215
|
return null;
|
|
198
216
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const JsonFile = require('@expo/json-file');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const { toPosixPath } = require('../filePath');
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Convert typescript paths to jest module mapping.
|
|
6
8
|
*
|
|
@@ -46,7 +48,7 @@ function convertTypescriptMatchToJestRegex(match) {
|
|
|
46
48
|
/** Convert a typescript match rule value to jest regex target */
|
|
47
49
|
function convertTypescriptTargetToJestTarget(target, prefix = '<rootDir>') {
|
|
48
50
|
const segments = target.split('/').map((segment) => (segment.trim() === '*' ? '$1' : segment));
|
|
49
|
-
return [prefix, ...segments].join(
|
|
51
|
+
return toPosixPath([prefix, ...segments].join(path.sep));
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
function mutateJestMappingFromConfig(jestConfig, configFile) {
|
package/src/rsc-utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
|
|
3
|
+
import { toPosixPath } from './filePath';
|
|
4
|
+
|
|
3
5
|
export const streamToString = async (stream) => {
|
|
4
6
|
const decoder = new TextDecoder();
|
|
5
7
|
const reader = stream.getReader();
|
|
@@ -48,9 +50,11 @@ export function renderJsxToReadableStream(jsx, { onError } = {}) {
|
|
|
48
50
|
return {
|
|
49
51
|
// HACK: To keep tests somewhat agnostic to the runtime environment, we'll make them relative to
|
|
50
52
|
// the current working directory. It'd be better to have a stable value to test against though.
|
|
51
|
-
id:
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
id: toPosixPath(
|
|
54
|
+
path.relative(
|
|
55
|
+
process.cwd(),
|
|
56
|
+
file.startsWith('file://') ? decodeURI(file.slice(7)) : file
|
|
57
|
+
)
|
|
54
58
|
),
|
|
55
59
|
chunks: [],
|
|
56
60
|
name,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const canariesDir = path.join(require.resolve('@expo/cli/package.json'), '../static/canary-full');
|
|
3
|
-
|
|
4
|
-
/** @type {import('jest-resolve').SyncResolver} */
|
|
5
|
-
function customResolver(request, options) {
|
|
6
|
-
// TODO: Remove this when we have React 19 in the expo/expo monorepo.
|
|
7
|
-
if (
|
|
8
|
-
// Change the node modules path for react and react-dom to use the vendor in Expo CLI.
|
|
9
|
-
/^(react|react\/.*|react-dom|react-dom\/.*)$/.test(request)
|
|
10
|
-
) {
|
|
11
|
-
options.basedir = canariesDir;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Fall back to Jest's default resolver
|
|
15
|
-
return options.defaultResolver(request, options);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = customResolver;
|