-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: Use require.resolve when yarn v2 is detected #15623
Closed
blake-transcend
wants to merge
18
commits into
cypress-io:develop
from
blake-transcend:issue-8008-typescript-plugins-pnp
Closed
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ac2f274
fix: Use require.resolve when yarn v2 is detected
blake-transcend e0dea49
Update resolve.js
blake-transcend e31ce74
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend f457d77
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 8120618
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 051aec4
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 89c245b
Update resolve.js
blake-transcend 89997d4
Update resolve.js
blake-transcend 4e47428
Update resolve.js
blake-transcend 67cf414
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend a056378
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend d889411
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 89d0252
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 2529c82
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend 7ce42cb
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend c135cda
Merge branch 'develop' into issue-8008-typescript-plugins-pnp
blake-transcend b8c5c6d
add 4_yarn_v2_spec
flotwig 2a58263
update spec to use `yarn node` to launch cli
flotwig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the problem is that
require.resolve
here is still not the patchedrequire.resolve
that Yarn v2 expects, since we are running Cypress inside of Cypress's own Electron-Node instance.Maybe the solution is to fall back to trying to use
@yarnpkg/pnp
to discover the path ifrequire.resolve('typescript')
fails? https://yarnpkg.com/advanced/pnpapi#resolvetounqualifiedThere 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 code actually works fine for me, my coworkers, and our CI. Could the cause be that your e2e test isn't executing cypress from yarn like you're supposed to (
yarn cypress ...
)? I believe that's where it injects its custom resolver. It would also probably be pretty difficult to detect which package manager you are using if you're executing outside of your package manager's environmentThere 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.
Oh, I didn't realize yarn v2 required launching stuff like that, it will probably pass once the test is updated then
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.
@blake-transcend I updated the spec to use
yarn node
to launchcypress run
via the CLI, but it still seems to fail with that same error. Since I'm not super familiar with how to test this (even manually), do you want to take a try at writing a test for this?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.
Sure I can try with your test