Skip to content

Conversation

@kitten
Copy link
Contributor

@kitten kitten commented Jan 14, 2026

Summary:

This implements the proposal to split the Jest preset (and dependencies) out into a separate package: react-native-community/discussions-and-proposals#926

  • react-native has an optional peer dependency on @react-native/jest-preset
  • react-native/jest-preset.js throws when @react-native/jest-preset isn't installed and instructs the user to add it to migrate
  • @react-native/jest-preset may be used directly as a Jest preset

Changelog:

[GENERAL] [BREAKING] - Move Jest preset to new @react-native/jest-preset package

Test Plan:

The jest preset is used, with some modifications, in facebook/react-native itself and CI should confirm that the changes work. Running jest on the repo similarly validates that the preset still works.

Otherwise, nothing has changed and the easiest way to test this is to use the preset in an existing project and try both preset set to the current value and preset set to "@react-native/jest-preset"

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 14, 2026
@facebook-github-bot facebook-github-bot added p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jan 14, 2026
@@ -0,0 +1,39 @@
# @react-native/jest-preset
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this great README ❤️

Copy link
Member

@huntie huntie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick nit: Can we use packages/jest-preset/ as the dir name? (I appreciate we aren't consistently one way or the other yet!)

@huntie huntie self-assigned this Jan 14, 2026
@kitten kitten force-pushed the @kitten/refactor/jest-preset-splitout branch from 00ce567 to 58b7292 Compare January 15, 2026 12:00
@kitten kitten force-pushed the @kitten/refactor/jest-preset-splitout branch from 58b7292 to 456d33e Compare January 15, 2026 12:05
@kitten kitten force-pushed the @kitten/refactor/jest-preset-splitout branch from c3f6b97 to c835025 Compare January 15, 2026 12:18
@kitten kitten requested a review from huntie January 15, 2026 12:25
@meta-codesync
Copy link

meta-codesync bot commented Jan 28, 2026

@huntie has imported this pull request. If you are a Meta employee, you can view this in D91700684.

Comment on lines +14 to +17
throw new Error(
'react-native/jest-preset is deprecated.\n' +
'To continue using the React Native Jest preset, Install "@react-native/jest-preset" and optionally update Jest\'s "preset" configuration.',
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kitten I'm debating about whether this counts as a deprecation, since we'll throw a hard error here.

  • I'd recommend we rephrase this to "has moved" — since the migration path is so straightforward. Move Fast.
  • If we want to keep "is deprecated", we should consider depending on the subpackage for one release so that this only warns.

cc @cortinico @cipolleschi

Copy link
Member

@huntie huntie Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incoming replacement copy:

     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'`,
    );

The config reference remains deprecated (and I'm leaving this wording in the new package README), but we're communicating the direct migration path for the breaking change here to the user in one go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants