-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[experimental] yarn pnp #7726
[experimental] yarn pnp #7726
Conversation
CI looks a bit worse than on my machine, it shouldn't fail that early 😄 |
@@ -26,6 +27,7 @@ | |||
"eslint-plugin-prettier": "^3.0.1", | |||
"eslint-plugin-react": "^7.1.0", | |||
"eslint-plugin-relay": "~0.0.19", | |||
"estraverse": "^4.2.0", |
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.
?
@@ -3,6 +3,7 @@ | |||
"devDependencies": { | |||
"@babel/core": "^7.1.0", | |||
"@babel/plugin-transform-strict-mode": "^7.0.0", | |||
"@babel/plugin-transform-modules-commonjs": "^7.1.0", |
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.
this should go on master
"prettier": "^1.16.1", | ||
"prettylint": "^1.0.0", | ||
"progress": "^2.0.0", | ||
"promise": "^8.0.2", | ||
"readable-stream": "^3.0.3", | ||
"realpath-native": "^1.0.0", | ||
"request": "^2.88.0", |
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.
?
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.
if it's for fetchSupporters
, it should go in website/package.json
"prettier": "^1.16.1", | ||
"prettylint": "^1.0.0", | ||
"progress": "^2.0.0", | ||
"promise": "^8.0.2", | ||
"readable-stream": "^3.0.3", | ||
"realpath-native": "^1.0.0", |
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.
for the integration test? if so, should land on master
setupFilesAfterEnv: ['<rootDir>/testSetupFile.js'], | ||
snapshotSerializers: [ | ||
'<rootDir>/packages/pretty-format/build/plugins/ConvertAnsi.js', | ||
'jest-snapshot-serializer-raw', | ||
require.resolve('jest-snapshot-serializer-raw'), |
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.
we can land this on master
const result = spawnSync( | ||
JEST_PATH, | ||
// TODO this is ugly and a problem for e2e tests related to config/resolution | ||
['--resolver', require.resolve('jest-pnp-resolver'), ...(args || [])], |
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.
yeah... no. Not sure how to properly deal with it, though
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.
Just to be clear, I did not intend for this to be merged in this or some similar form 😄 this PR is just to share what I've done and what the problems are so we can possibly get back to this when there are good solutions for them :)
@SimenB I'll make a PR for the changes you suggested to integrate into master - I guess revealing possible improvements like these would be one of the main benefits of pnp if we could use it at some point |
Regarding the other changes such as |
Really nice! I think it could be simplified if there was a way to remove the need for |
Regarding the packages required at the root, can you list why they are needed? It's usually only a way to workaround a legit issue in a package, and maybe the right fix would simply be to propagate the fixes upstream. |
I believe that should work.
I'll compile a non-exhaustive list, there would probably be a lot more cases of this to show up if we want to make all scripts work :) |
Here's a few: If
Not sure why this is happening. If
This might be an error on ESLint side and thus actionable? If
Not sure why the custom Jest pnp resolver doesn't manage to resolve this |
Seems like an pnp bug, @arcanis?
Yeah, send them a PR
Yeah, weird. Seems like something it should handle |
Actually, looks like this is babel/babel-eslint#680, which was fixed in |
Needs facebook/fbjs#330 to avoid the peer dep warning, then |
Closing this for now (was mostly meant to document the issues encountered while experimenting anyway), will attempt this again once pnp has matured enough to support complex setups / has become more of a standard way of doing dependencies. |
Current notes from today's session:
|
https://github.com/jeysal/jest/tree/yarn-pnp has the fixes and workarounds, I'll land some of the fixes in Jest master as well |
I opened #9476 using berry, if you wanna poke at it again 🙂 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Edit: Just to be clear, I did not intend for this to be merged in this or some similar form 😄 this PR is just to share what I've done and what the problems are so we can possibly get back to this when there are good solutions for them :)
Summary
Since it seems nobody has attempted this before, I tried for about an hour to make the Jest repo Yarn pnp-compatible. My impression is that it would be possible (with a significant amount of additional effort put into it), but might not be desirable until pnp has matured further.
What works:
yarn
, including post installyarn lint
, mostlyWhat doesn't:
yarn flow
, this fix did not help eitherno-unresolved
errors because of dependencies that are correctly declared in the correspondingpackage.json
, but not the root. I consider this to be quite a deal breaker, because I really do not want a dependency onreact
in the rootexamples/react-native
because ofnode_modules/something
all over the Jest preset file, although @SimenB may have fixed that in fix: userequire.resolve
injest-preset
facebook/react-native#22972I did not check any of the other scripts.
cc @arcanis in case you're interested, although probably none of this is new to you 😅
Test plan