-
Notifications
You must be signed in to change notification settings - Fork 352
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
feat: add yarn modern pnp support #599
Conversation
This is required because using `yarn` command-prefix will end up running: `npx yarn` which doesnt resolve correctly in pnp and results in using yarn v1 not the specified yarn. Using `command` will overwrite the entire command and allow `yarn dlx` to be used instead of `npx` which properly runs and resolves.
Just updated because we found using |
Any update on this? |
This really needs some feedback from @jaffrepaul and colleagues from the Cypress organization. The existing yarn examples in this repository are using Yarn 1 (Classic) and these should stay there because this version is still important. Adding Yarn Berry (aka Yarn v2 & v3) examples would be a great addition. |
My suggestion would be to separate out the changes to index.js to fix the issues mentioned in the original post and put these changes into a separate PR. Possibly these could be fast-tracked. That depends on the capacity on the The examples would then be a separate PR. Suggestion for the examples:
I wouldn't put any new effort into this until there is feedback from the repository owners. |
I saw that you submitted some new commits, however you didn't write any comment. There hasn't been any comment from the Cypress.io core team either. This comment should get your PR added to the support process. |
I ran your branch and I found that the v9 job succeeds, whilst the v12 job fails. Suggestions
Edit: 4. and 5. were incorrect suggestions. Comments
|
@MikeMcC399 Yeah, still working on a failing github action over in my repo after pulling in the latest. I was trying yesterday to see if your changes in v5 worked, but for PnP it still fails since it tried to import cypress and in pnp it's in a different location. I'm working this morning on getting the last action running then I'll update when it's ready again. |
With the changes that I suggested, your PR is basically working. I didn't check if it causes compatibility issues with any of the other tests though. |
@MikeMcC399 Thanks for those suggesstions. I'll remove that v9 then. As for the gitignore updates, adding the cache and pnp files are only required if you want to turn on zero installs. The bug is the same for regular pnp (where it downloads on yarn install) as it is with zero installs, so I think theres no need to add the additional files for any dependencies to the repo. The difference here is that removing |
Ah, I'm a relative newcomer to yarn, so sorry if I didn't work out the difference between zero installs and pnp! |
@MikeMcC399 No worries! It's definitely not simple getting it all setup. This should be good to go now, the action is working on my fork and I ran the updated action to our internal application repo and it passed there as well. |
Co-authored-by: Matt Schile <[email protected]>
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.
LGTM, thanks for the contribution @PilotConway 🎉
This comment was marked as resolved.
This comment was marked as resolved.
Congratulations on getting your first approval from the Cypress.io team! This should help those who want to use Yarn Plug'n'Play, however the use of |
Unfortunately there is an issue in Cypress with Yarn Modern PnP. See Running yarn
yarn dlx cypress open followed by selecting E2E testing results in the Cypress app results in a Bluebird issue: -The issue is logged in cypress-io/cypress#26567. I was able to reproduce this from scratch and it even hangs up the Cypress App on first setup, so this is quite a show-stopper for Cypress with Yarn Modern, as pnp is the default mode for any new installations. |
@MikeMcC399 Agree this is definitely a workaround to at least get it to work, and definitely think allowing the config to change Also in terms of running locally, its been working for us locally without any issue, but I'm seeing we were a couple versions behind (12.8.1) and something broke recently in 12.10 so that would explain it. We don't use dlx locally and use the installed version directly. However, I think this is definitely a separate issue and the workaround can be attaching a version to the dlx command to run the version before this issue. |
It seems that yarn add [email protected] -D -E will work around the issue for E2E testing. |
🎉 This PR is included in version 5.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I suggest to take I tried out using just yarn cypress run and that looks to work well. It starts the version of Cypress already installed in the What do you think? The Yarn dlx documentation does not explain this well. I just tried it out and this is the way it works with Yarn |
|
Fixes the issue with users of yarn pnp where the require of cypress happens before the checks for command and command-prefix, causing the error
cannot find module 'cypress'
.yarn pnp users will be required to use the
command
property since those bypass the npx running of cypress and instead run through yarn which will import properly.fixes #589
fixes #430