Skip to content
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

Yarn Modern (3) using default pnp hangs at Initializing config... #26676

Closed
MikeMcC399 opened this issue May 5, 2023 · 11 comments · Fixed by #26735
Closed

Yarn Modern (3) using default pnp hangs at Initializing config... #26676

MikeMcC399 opened this issue May 5, 2023 · 11 comments · Fixed by #26735
Labels
CT Issue related to component testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented May 5, 2023

Current behavior

After installing Cypress with Yarn Modern (3.5.1) using the default Yarn Plug'n'Play the first start of cypress open hangs at "Initializing config..." after selecting E2E Testing.

Edit: The issue also affects Component Testing. I have however only given repro steps for the simpler case of E2E Testing.

Desired behavior

If the app finds configuration errors it should not hang. Instead it should output an error message.

After opening the Cypress app for the first time, it should provide default configuration parameters and allow selection of example tests.

Test code to reproduce

Execute the following in a bash terminal window:

mkdir cy-yarn-pnp
cd cy-yarn-pnp
npm install yarn@latest -g
yarn init -y
yarn set version berry # finds and installs 3.5.1
yarn add cypress@latest -D -E
yarn cypress open

Select E2E Testing
Click Continue (to accept addition of cypress.config.js, cypress/support/e2e.js, cypress/support/commands.js and cypress/fixtures/example.json)

image

Note that .yarnrc.yml contains only:

yarnPath: .yarn/releases/yarn-3.5.1.cjs

Cypress Version

12.11.0

This issue is a regression from Cypress 12.9.0.

Node version

18.16.0

Operating System

Ubuntu 22.04

Debug Logs

Debug logs go into an endless loop including

'Error', message: 'Your configFile is invalid: /xxx/github/cy-yarn-pnp/cypress.config.js\n'

Other

Workaround

Revert to Cypress 12.9.0.

@PilotConway
Copy link

I tried your steps here and a few others and was able to reproduce this. But interestingly its only under one condition: you install cypress locally then run yarn dlx. Likely theres something conflicting in yarn when you have cypress installed in the project locally but try to run dlx which like npx will download and run a different copy of cypress than the one installed in the repo. If I don't install cypress and just use yarn dlx or I install and use the installed copy, I don't get the infinite spinner.

Not sure if this is helpful or not, but might help someone follow a lead to what might be the issue.

These commands work (or at least get you to the bluebird error from #26567):

mkdir cy-yarn-pnp
cd cy-yarn-pnp
yarn init -2 # shortcut to init a yarn app with berry by default
yarn dlx cypress open # download and run cypress, no cypress installed locally
mkdir cy-yarn-pnp
cd cy-yarn-pnp
yarn init -2 # shortcut to init a yarn app with berry by default
yarn add -D cypress
yarn cypress open # run the locally installed cypress

And like you posted, this one doesn't work:

mkdir cy-yarn-pnp
cd cy-yarn-pnp
yarn init -2 # shortcut to init a yarn app with berry by default
yarn add -D cypress
yarn dlx cypress open # download and run a different cypress than the one in the package

@MikeMcC399
Copy link
Contributor Author

@PilotConway

Thanks for pointing out that yarn dlx cypress open will interpret that as cypress@latest, whatever has been previously installed by yarn. I had assumed dlx worked like npx and that is not the case.

Is there some other way in Yarn PnP to start exactly the version of Cypress which has been install by yarn add?

@PilotConway
Copy link

Yeah, running yarn cypress will just run what's locally installed.

@MikeMcC399
Copy link
Contributor Author

@PilotConway

Yeah, running yarn cypress will just run what's locally installed.

Thank you! I've taken dlx out of the steps to reproduce and I've removed the workaround section, since it doesn't seem to always work.

@PilotConway
Copy link

@MikeMcC399 Are you still seeing the error when running yarn cypress open? Because running it that way worked for me (in terms of this bug, and not #26567), and I didn't get the infinite spinner.

The only way I'm able to reproduce this specific bug is the combination of yarn add -D cypress and yarn dlx cypress open.

@MikeMcC399
Copy link
Contributor Author

@PilotConway

I can reproduce on Ubuntu 22.04 and Windows 11 with exactly

mkdir cy-yarn-pnp
cd cy-yarn-pnp
npm install yarn@latest -g
yarn init -y
yarn set version berry # finds and installs 3.5.1
yarn add cypress@latest -D -E
yarn cypress open

then

  • Select E2E Testing
  • Click Continue to accept the default file generation

and on both operating systems I get the Cypress rotating spinner.

It only hangs up the first time it is opened when immediately previously the config onboarding has been carried out.

@PilotConway
Copy link

@MikeMcC399 Interesting. Well then, guess it's not just mismatched cypress versions. 🤷‍♂️

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented May 6, 2023

This is a regression from Cypress 12.9.0, so the workaround would be to revert to Cypress 12.9.0. It appears to be related to extensive Yarn Plug'n'Play changes made in Cypress PR #26452 for Cypress 12.10.0.

If Cypress has already been successfully set up using version 12.9.0 or earlier and then Cypress is updated to version 12.10.0 or 12.11.0 then starting the Cypress App with yarn cypress open does not lead to the app hanging at "Initializing config...", instead, when "E2E Testing" is selected in the Cypress App, "Cypress configuration error" appears and no test can be run. On Ubuntu 22.04 the error message is:

Your application tried to access bluebird, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: bluebird Required by: packages/config/src/project/

Require stack:

./packages/config/src/project/utils.ts

The bluebird error message is also reported in #26567 (comment) for E2E testing.

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented May 6, 2023

The hang is also reproducible on Cypress 12.10.0 & 12.11.0 when selecting Component Testing after Framework dependencies have been installed and on the first time of confirming the Cypress config files to set up by clicking on Continue.

On subsequent starts of yarn cypress open on Ubuntu 22.04 the bluebird error is displayed and there is no hang.

@chrisbreiding
Copy link
Contributor

Thanks for reporting and looking into this. I was able to reproduce it as well. I'll forward it to the appropriate team. They'll evaluate the priority of this ticket and consider their capacity to pick it up. Please note that this does not guarantee that this issue will be resolved.

@chrisbreiding chrisbreiding removed their assignment May 11, 2023
@chrisbreiding chrisbreiding added CT Issue related to component testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels May 11, 2023
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 23, 2023

Released in 12.13.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v12.13.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CT Issue related to component testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants