Skip to content

chore: optional jest peer dep #1101

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

Merged
merged 1 commit into from
Sep 9, 2022
Merged

Conversation

mdjastrzebski
Copy link
Member

Summary

Make Jest 28 an optional peer dep.

Test plan

All checks should pass.

},
"peerDependenciesMeta": {
"jest": {
"optional": true
Copy link
Member

Choose a reason for hiding this comment

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

does this work with npm too? otherwise jest will be installed as a part of npm install

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

FYI. npm 8 is available since node 16. node 14 and 15 has npm 7

Copy link
Member Author

Choose a reason for hiding this comment

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

Npm v7 docs also mentions support for peerDepsMeta + optional: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#peerdependenciesmeta

@mdjastrzebski mdjastrzebski force-pushed the chore/optional-jest-peer-dep branch from 9512418 to a2a11af Compare September 8, 2022 15:25
@mdjastrzebski mdjastrzebski merged commit 7347e92 into main Sep 9, 2022
@mdjastrzebski mdjastrzebski deleted the chore/optional-jest-peer-dep branch September 9, 2022 07:04
@friederbluemle
Copy link
Contributor

Is there anything in RNTL that requires Jest 28 or higher? Or does it work with Jest 27 and 26 as well? Asking because only RN 0.71 and later come with Jest 29. Prior to that the RN template shipped with Jest 26.
If there is no strict dependency, can this be loosened (preferred)? Of if there is, do we have a RN-RNTL compatibility matrix?

@mdjastrzebski
Copy link
Member Author

@friederbluemle You should try updating to Jest 29 regardless of your RN version, as afaik these are quite independent and older RN version should work the latest Jest, despite the fact that RN template ships given versions of Jest by default.

If that does not work for you, then afair we require Jest 28 when you use fake timers. You'll find more info in our v11 migration guide. If you do not use any fake timers, then Jest will probably work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants