-
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
"Your application tried to access bluebird, but it isn't declared in your dependencies." When using Component Testing with Yarn PnP #26567
Comments
Thanks for the bug report - I was able to reproduce this. A few PRs have landed recently for better Yarn 3 support - hopefully we can get to a point where it all just works. Made #26570 to hopefully fix this, I'll post a pre-release binary here soon so you can give it a test without waiting for the next release. |
I tried adding bluebird as a dep on the off chance it would work, but it didn't. I'm just going to convert the code to use a native Promise. |
I removed Bluebird: #26570 |
Ah, but now I end up with the same problem in another package. I think we need another option - bluebird is used in at least 64 files on the server, refactoring those out is probably impractical. And if not I wonder if we need to do something specific for Yarn 3? I have other projects using Yarn 3 that work just fine though - I wonder what's the difference. |
In case this helps @lmiller1990, I have been running Yarn 3 with Cypress for some time now, and this issue just showed up when upgrading |
Same @Ckrill I've been using Cypress with Yarn Pnp since at least [email protected] without any issues (just using a esbuild preprocessor). |
@Teajey does this solution work for you? |
Thanks for the quick and detailed response! Adding I'm unfortunately not familiar with using esbuild preprocessors. Is this a custom one, or one that I can find online, .e.g: https://github.com/bahmutov/cypress-esbuild-preprocessor ? |
@Teajey I'm using this one but both should be equivalent: https://github.com/sod/cypress-esbuild-preprocessor#readme |
Oh, I did not realize this broken in Cy 12.10. Is that the same for you @Teajey? We added some code to correctly integrate with PnP in Cy 12.10:
It looks like this actually exposed more problems than it solved. I wonder if we need more work to correctly support Yarn 3. I do not think esbuild-preprocessor will help with the current issue @Teajey is encountering - preprocesses are only used for loading the specs, you aren't even getting that far. |
This is my first time attempting to use component testing with PnP. I was encountering the dependency issue, so I waited for 12.10. I can't speak for <12.10 |
@lmiller1990 Also, I must say: we're not using using CT at all, so I can only speak for regular e2e testing |
Gotcha... thanks, seems like Yarn 3 is more negatively impacted by the "fix" we added. I won't be able to fix this in the next version (12.10) but we can try to get something done for the following one. I'll post updates here. |
Confirming that this still occurs in 12.11.0. |
I'm not sure how to fix this one yet, I don't have the bandwidth to work on this right now. I'll try to get some 👀 on it soon. I wish Yarn 3 was not so difficult to integrate with. Is there any kind of |
A similar issue also exists with E2E testing, Cypress 12.11.0. I will try to add E2E steps to reproduce. |
Steps to reproduce: Ubuntu 22.04 mkdir cy-yarn-pnp
cd cy-yarn-pnp
npm install yarn@latest -g
yarn set version berry # finds and installs 3.5.1
yarn init -y
yarn add cypress@latest -D -E
yarn cypress open Note error
Cypress v12.11.0 App opens Cypress App now hangs at "Initializing config..." Kill the app and start again with yarn cypress open On Windows 11 the error looks slightly different: (PnP is the default mode for Yarn Modern) Edit: Confirmed also reproducible in Cypress |
|
I'm wondering if cypress/packages/config/package.json Lines 19 to 33 in 1d7ae10
cypress cli itself already requires bluebird.
I tried to pull the cypress repo and test the change locally, but using yarn link I actually can't reproduce the bug to see if that would do it to make a PR and I have to bail on testing this for now. If I get time next week I might try again. |
I tried adding Yarn 3 has what feels like an endless list of compatibility issues with many libraries. |
Is it time to move away from the 3 year old bluebird? https://github.com/petkaantonov/bluebird#introduction |
Moving away from Bluebird is a pretty big lift - we use a lot of things without 1:1 mappings, like Even if we did move away from it, I suspect we hit the same issue with a different dependency - it just happens to be Bluebird right now, since that's probably the first dependency that get |
|
This issue no longer occurs with Cypress 12.13.0. Cypress 12.13.0 CT with Yarn Plug'n'Play and vite is however broken (no dependency detection, config file not found). |
Confirmed... for our E2E testing, I've unpinned 12.9.0 and we are happily using 12.13.0. Thanks for the effort! |
What do you think about closing this issue though since the |
If the error described in this issue no longer occurs then yeah, I think it makes sense to close it 👍 |
Current behavior
When running Cypress Component Testing with interactive GUI in a Yarn PnP project
Desired behavior
It should continue as expected without error.
It looks like the package
@packages/config
doesn't declarebluebird
in it's dependencies, and Yarn PnP's strictness requires that it is.Test code to reproduce
Follow these steps in an empty directory:
Click 'Component Testing'
Create a 'React.js/Vite' project, click 'Next step'
Hopefully the dev dependencies are detected, although I found at first that they weren't and I had to click 'Skip'
Configuration files are added, press 'Continue'
I've also found that the 'Initializing config...' screen hangs for a long time. Long enough that I end up closing and re-running
yarn cypress open
, and returning to Component Testing, where it then proceeds as expected.At this point you should see the same page as the screenshot above.
Cypress Version
12.10.0
Node version
16.18.0
Operating System
macOS Ventura 13.0.1
Debug Logs
No response
Other
I'm not sure if there's a temporary workaround for this. I don't think
@packages/config
can be referenced by Yarn'spackageExtensions
setting, since it doesn't seem to be a normal part of the dependency treeThe text was updated successfully, but these errors were encountered: