-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Split out Jest preset to @react-native/jest-preset
#55169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Split out Jest preset to @react-native/jest-preset
#55169
Conversation
| @@ -0,0 +1,39 @@ | |||
| # @react-native/jest-preset | |||
There was a problem hiding this comment.
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 ❤️
There was a problem hiding this 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!)
00ce567 to
58b7292
Compare
58b7292 to
456d33e
Compare
c3f6b97 to
c835025
Compare
| 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.', | ||
| ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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-nativehas an optional peer dependency on@react-native/jest-presetreact-native/jest-preset.jsthrows when@react-native/jest-presetisn't installed and instructs the user to add it to migrate@react-native/jest-presetmay be used directly as a Jest presetChangelog:
[GENERAL] [BREAKING] - Move Jest preset to new
@react-native/jest-presetpackageTest Plan:
The jest preset is used, with some modifications, in
facebook/react-nativeitself and CI should confirm that the changes work. Runningjeston 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
presetset to the current value andpresetset to"@react-native/jest-preset"