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
fixed using wrong package manager in yarn workspace projects #503
Conversation
also setup jest test so we can start building more tests
…xpo#473) * Remove jest-expo plugin on eject and use jest-react-native instead * update jest.preset only when it is set to jest-expo * add warning message when jest-preset is updated to something different from jest-expo
* Update troubleshooting related to running a VPN * Update README.md
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.
Sorry for the delay in getting this reviewed. This change seems reasonable to me.
Thanks for also adding a test case. I had some minor comments about Jest configuration, but otherwise this seems ready to be merged.
package.json
Outdated
}, | ||
"jest": { | ||
"moduleFileExtensions": [ "js" ], | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(js)$", |
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 believe these are the default settings in Jest now, so we should be able to omit moduleFileExtensions
and testRegex
.
package.json
Outdated
"moduleFileExtensions": [ "js" ], | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(js)$", | ||
"testPathIgnorePatterns": [ | ||
"\\.snap$", |
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 this can be omitted.
also setup jest test so we can start building more tests
…te-react-native-app into yarn-lookup-fix
done |
ping |
Hey, looks like something went wrong with merging changes from master. Could you please rebase this branch onto master? |
also setup jest test so we can start building more tests
…te-react-native-app into yarn-lookup-fix
rebased |
fixed using wrong package manager in yarn workspace projects
Thanks @connectdotz! |
this is to fix react-native-scripts not able to find
yarn.lock
file in the monorepo (workspaces) projects, which caused the react-native-scripts to use the wrong package manager and failed.yarn workspace project puts the
yarn.lock
in the project root instead of the react native app directory. Since the current implementation only looks for yarn.lock in the app/cwd directory, it doesn't see the file and will wrongly select npm as the package manager. The new lookup method will traverse up the filesystem (similar to node module resolution) until it either finds the file or hits the filesystem root.outline the changes:
react-native-scripts/src/utils/pm.js
, which performs the new logic described above.yarn test
to guard against regression. Also updatedtaskfile.js
to exclude tests in the build.