-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Add missing babel-jest dependency to react-native package #46462
Conversation
This pull request was exported from Phabricator. Differential Revision: D62583665 |
This pull request was exported from Phabricator. Differential Revision: D62583665 |
25ddc16
to
d296317
Compare
…6462) Summary: Pull Request resolved: facebook#46462 While adding D62583337, I noticed that `react-native` doesn't specify `babel-jest` as a dependency, despite referencing it in the included `jest-preset.js` — instead this would need to be installed by the template/project. If we want to change this in future, we should consider a separate `react-native/jest-preset` package. However, I strongly believe this is the right location for this dependency: installing `react-native` = all parts of it work. (Note that in the React Native monorepo, we are using `dependencies` for both dev and runtime deps in packages.) Changelog: [Internal] Reviewed By: robhogan Differential Revision: D62583665
This pull request was exported from Phabricator. Differential Revision: D62583665 |
d296317
to
fdc0c56
Compare
…6462) Summary: Pull Request resolved: facebook#46462 While adding D62583337, I noticed that `react-native` doesn't specify `babel-jest` as a dependency, despite referencing it in the included `jest-preset.js` — instead this would need to be installed by the template/project. If we want to change this in future, we should consider a separate `react-native/jest-preset` package. However, I strongly believe this is the right location for this dependency: installing `react-native` = all parts of it work. (Note that in the React Native monorepo, we are using `dependencies` for both dev and runtime deps in packages.) Changelog: [Internal] Reviewed By: robhogan Differential Revision: D62583665
This pull request was exported from Phabricator. Differential Revision: D62583665 |
fdc0c56
to
8d2e324
Compare
…6462) Summary: Pull Request resolved: facebook#46462 While adding D62583337, I noticed that `react-native` doesn't specify `babel-jest` as a dependency, despite referencing it in the included `jest-preset.js` — instead this would need to be installed by the template/project. If we want to change this in future, we should consider a separate `react-native/jest-preset` package. However, I strongly believe this is the right location for this dependency: installing `react-native` = all parts of it work. (Note that in the React Native monorepo, we are using `dependencies` for both dev and runtime deps in packages.) Changelog: [Internal] Reviewed By: robhogan Differential Revision: D62583665
Summary: Pull Request resolved: facebook#46465 Resolves facebook#46355. Changelog: [Internal] bypass-github-export-checks Differential Revision: D62583337 Reviewed By: robhogan
…6462) Summary: Pull Request resolved: facebook#46462 While adding D62583337, I noticed that `react-native` doesn't specify `babel-jest` as a dependency, despite referencing it in the included `jest-preset.js` — instead this would need to be installed by the template/project. If we want to change this in future, we should consider a separate `react-native/jest-preset` package. However, I strongly believe this is the right location for this dependency: installing `react-native` = all parts of it work. (Note that in the React Native monorepo, we are using `dependencies` for both dev and runtime deps in packages.) Changelog: [Internal] Reviewed By: robhogan Differential Revision: D62583665
This pull request was exported from Phabricator. Differential Revision: D62583665 |
8d2e324
to
d24fe8b
Compare
The way it typically is handled in a project is that the Babel configuration (and hence babel-jest @babel/core @babel/preset-env specified in https://jestjs.io/docs/getting-started#using-babel) is handled on the user side. It's some ancient times, but I recall this setup was necessary for Jest to resolve Babel tooling properly especially in monorepo setups. Not sure if anything changed here, but I'd like to make sure this change is not breaking for monorepo setups out there, i.e. if they use a different version of babel-jest in their project, as this may effectively lock-in particular Jest version to a particular React Native version. |
@@ -23,7 +23,6 @@ | |||
"@react-native/core-cli-utils": "0.77.0-main", | |||
"@react-native/eslint-config": "0.77.0-main", | |||
"@react-native/metro-config": "0.77.0-main", | |||
"babel-jest": "^29.6.3", |
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.
I think effectively we need babel-jest both here and in devDependencies of react-native
. It's surprising to me that this monorepo setup requires devDependencies to be dependencies. Lots of unnecessary kBs sent to npm registry
@thymikee Oh, interesting! That's a bit awkward and undocumented 😐 I wonder to what extent we can rely on monorepo setups being "power users" and, if they need to override any built-in RN dep/devDep, they can do so with From our point of view, shipping this with |
This pull request has been merged in 8f1c227. |
This pull request has been reverted by 259f61a. |
Summary:
While adding D62583337, I noticed that
react-native
doesn't specifybabel-jest
as a dependency, despite referencing it in the includedjest-preset.js
— instead this would need to be installed by the template/project.If we want to change this in future, we should consider a separate
react-native/jest-preset
package. However, I strongly believe this is the right location for this dependency: installingreact-native
= all parts of it work.(Note that in the React Native monorepo, we are using
dependencies
for both dev and runtime deps in packages.)Changelog: [Internal]
Differential Revision: D62583665