jest-expo 55.0.0-canary-20260119-70f7c28 → 55.0.0-canary-20260119-17896bf

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.
@@ -91,6 +91,14 @@ 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
+
94
102
  preset.testEnvironment = 'node';
95
103
  if (!preset.setupFiles) {
96
104
  preset.setupFiles = [];
@@ -0,0 +1,18 @@
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "55.0.0-canary-20260119-70f7c28",
3
+ "version": "55.0.0-canary-20260119-17896bf",
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-20260119-70f7c28",
41
- "@expo/json-file": "10.0.9-canary-20260119-70f7c28",
40
+ "@expo/config": "12.0.14-canary-20260119-17896bf",
41
+ "@expo/json-file": "10.0.9-canary-20260119-17896bf",
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.2.0",
51
+ "react-test-renderer": "19.1.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-20260119-70f7c28",
56
+ "expo": "55.0.0-canary-20260119-17896bf",
57
57
  "react-native": "*",
58
58
  "react-server-dom-webpack": "~19.0.3 || ~19.1.4 || ~19.2.3"
59
59
  },
@@ -100,6 +100,7 @@ module.exports = {
100
100
  argumentsCount: 0,
101
101
  key: 'setSystemBrightnessModeAsync',
102
102
  },
103
+ { name: 'useSystemBrightnessAsync', argumentsCount: 0, key: 'useSystemBrightnessAsync' },
103
104
  ],
104
105
  ExpoCalendar: [
105
106
  {
@@ -435,7 +436,7 @@ module.exports = {
435
436
  { name: 'uploadTaskStartAsync', argumentsCount: 4, key: 'uploadTaskStartAsync' },
436
437
  { name: 'writeAsStringAsync', argumentsCount: 3, key: 'writeAsStringAsync' },
437
438
  ],
438
- ExpoGL: [],
439
+ ExponentGLView: [],
439
440
  ExponentGyroscope: [
440
441
  { name: 'isAvailableAsync', argumentsCount: 0, key: 'isAvailableAsync' },
441
442
  { name: 'setUpdateInterval', argumentsCount: 1, key: 'setUpdateInterval' },
@@ -568,7 +569,6 @@ module.exports = {
568
569
  },
569
570
  ],
570
571
  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
- ExpoGL: {
1115
+ ExponentGLView: {
1116
1116
  addListener: { type: 'function' },
1117
1117
  removeListeners: { type: 'function' },
1118
1118
  },
@@ -1212,10 +1212,6 @@ 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
- },
1219
1215
  ExpoRouterNativeLinkPreview: {
1220
1216
  addListener: { type: 'function' },
1221
1217
  removeListeners: { type: 'function' },
@@ -1454,7 +1450,7 @@ module.exports = {
1454
1450
  ExpoLivePhoto: {
1455
1451
  propNames: ['contentFit', 'isMuted', 'source', 'useDefaultGestureRecognizer'],
1456
1452
  },
1457
- ExpoGL: { propNames: ['enableExperimentalWorkletSupport', 'msaaSamples'] },
1453
+ ExponentGLView: { propNames: ['enableExperimentalWorkletSupport', 'msaaSamples'] },
1458
1454
  ExpoRouterNativeLinkPreview: {
1459
1455
  propNames: [
1460
1456
  'destructive',
@@ -192,25 +192,7 @@ 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) => {
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
- });
195
+ const filePath = stackTrace.getSync().find((line) => line.fileName.includes(moduleName));
214
196
  if (!filePath) {
215
197
  return null;
216
198
  }
@@ -1,8 +1,6 @@
1
1
  const JsonFile = require('@expo/json-file');
2
2
  const path = require('path');
3
3
 
4
- const { toPosixPath } = require('../filePath');
5
-
6
4
  /**
7
5
  * Convert typescript paths to jest module mapping.
8
6
  *
@@ -48,7 +46,7 @@ function convertTypescriptMatchToJestRegex(match) {
48
46
  /** Convert a typescript match rule value to jest regex target */
49
47
  function convertTypescriptTargetToJestTarget(target, prefix = '<rootDir>') {
50
48
  const segments = target.split('/').map((segment) => (segment.trim() === '*' ? '$1' : segment));
51
- return toPosixPath([prefix, ...segments].join(path.sep));
49
+ return [prefix, ...segments].join('/');
52
50
  }
53
51
 
54
52
  function mutateJestMappingFromConfig(jestConfig, configFile) {
package/src/rsc-utils.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import path from 'path';
2
2
 
3
- import { toPosixPath } from './filePath';
4
-
5
3
  export const streamToString = async (stream) => {
6
4
  const decoder = new TextDecoder();
7
5
  const reader = stream.getReader();
@@ -50,11 +48,9 @@ export function renderJsxToReadableStream(jsx, { onError } = {}) {
50
48
  return {
51
49
  // HACK: To keep tests somewhat agnostic to the runtime environment, we'll make them relative to
52
50
  // the current working directory. It'd be better to have a stable value to test against though.
53
- id: toPosixPath(
54
- path.relative(
55
- process.cwd(),
56
- file.startsWith('file://') ? decodeURI(file.slice(7)) : file
57
- )
51
+ id: path.relative(
52
+ process.cwd(),
53
+ file.startsWith('file://') ? decodeURI(file.slice(7)) : file
58
54
  ),
59
55
  chunks: [],
60
56
  name,
package/src/filePath.js DELETED
@@ -1,9 +0,0 @@
1
- const REGEXP_REPLACE_SLASHES = /\\/g;
2
-
3
- function toPosixPath(filePath) {
4
- return filePath.replace(REGEXP_REPLACE_SLASHES, '/');
5
- }
6
-
7
- module.exports = {
8
- toPosixPath,
9
- };