Remove react-native/jest-preset subpath (#57481)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57481

It's been two releases since we separated `react-native/jest-preset` in 0.85 and this has been updated in the template.

Clean up by removing internal redirect module, public export, and peer dependency.

Changelog:
[General][Breaking] - `react-native/jest-preset` is removed — all projects must now migrate to `react-native/jest-preset` (package)

Reviewed By: rubennorte

Differential Revision: D111035221

fbshipit-source-id: d66fed9218c801201c1e965f8163f048934d4200
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2026-07-08 06:28:17 -07:00
1 parent 537d867316
commit 9ee21ddd9b
3 files changed
-38

No files matched your search

-6
View File
@@ -36,9 +36,3 @@ module.exports = {
```
You can further customize your Jest configuration by specifying other options. See [Jest's `jest.config.js` documentation](https://jestjs.io/docs/configuration) to learn more.
### Migration Note
This Jest preset used to be part of the core `react-native` package and accessible at `react-native/jest-preset.js`. As long as `@react-native/jest-preset` is installed, `react-native/jest-preset.js` will be aliased to this package and continue to work but is deprecated.
Follow the installation instructions above to migrate to `@react-native/jest-preset` and change `preset: 'react-native'` to `preset: '@react-native/jest-preset` to migrate.
-26
View File
@@ -1,26 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @format
*/
'use strict';
try {
module.exports = require('@react-native/jest-preset');
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
throw new Error(
`The React Native Jest preset has moved to a separate package.
To migrate, please install "@react-native/jest-preset" and update your
jest.config.js to reference:
preset: '@react-native/jest-preset'`,
);
} else {
throw error;
}
}
-6
View File
@@ -52,7 +52,6 @@
"types": null,
"default": "./src/asset-registry.js"
},
"./jest-preset": "./jest-preset.js",
"./rn-get-polyfills": "./rn-get-polyfills.js",
"./src/fb_internal/*": "./src/fb_internal/*",
"./package.json": "./package.json"
@@ -69,7 +68,6 @@
"gradle/libs.versions.toml",
"index.js",
"index.js.flow",
"jest-preset.js",
"Libraries",
"LICENSE",
"React-Core.podspec",
@@ -136,16 +134,12 @@
"featureflags": "node ./scripts/featureflags/index.js"
},
"peerDependencies": {
"@react-native/jest-preset": "0.87.0-main",
"@types/react": "^19.1.1",
"react": "^19.2.3"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@react-native/jest-preset": {
"optional": true
}
},
"dependencies": {