-
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
yarn 2 - cy.readFile does not respect PnP #18072
Comments
I believe I figured this out. When updating to yarn PNP, I got these errors as well. (Cypress: 9.4.1, cypress-axe: ) All the |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Any version after about 9.x does not support yarn 2 in cypress (because of various open issues), so this cannot be tested against the latest version. |
Hi @francisu , thanks for responding. I will route this to the backlog. In the spirit of transparency I do not see Cypress fixing Yarn 2 support in older versions of Cypress. Any fixes will be made rolling forward. |
|
This should probably have the
CT
We have Cypress 12.x working successfully with Yarn Plug'n'Play in the github-action repository https://github.com/cypress-io/github-action#yarn-plugnplay. This is however demonstrating E2E testing not component testing. As far as component testing is concerned, I think you are right about some open issues which need to be resolved first. |
Cypress needs some more work doing for Yarn Plug'n'Play with Component Testing.
|
is also related. |
Considering that the current version of Yarn Modern has now moved to v4 (see blog) there is probably not a lot of benefit to keeping this issue open. The steps to reproduce would also need to be completely reworked to be useful at all.
|
Current behavior
When using cypress-react-selector, with yarn 2, running a test with open-ct, I get this error:
vendors~ctChunk-reactdevtools.71f4c4a828a7b7522abe.js:5722 CypressError:
cy.readFile("./.yarn/cache/resq-npm-1.10.1-c0eb904091-57458eb232.zip/node_modules/resq/dist/index.js")
failed while trying to read the file at the following path:/Users/francis/temp/test-material-ui/.yarn/cache/resq-npm-1.10.1-c0eb904091-57458eb232.zip/node_modules/resq/dist/index.js
The following error occurred:
Desired behavior
The test should be successful
Test code to reproduce
To reproduce:
(will open GUI - Click on the first test)
====> The error will happen at that point
Cypress Version
8.3.1
Other
Here is a transcript of the chat with the creator of yarn 2 about this issue (note the issue reference is in create-react-selector, that was the initial one I filed).
francisu — Today at 9:13 AM
Any idea how to fix this one? Cypress is supposed to have PnP enabled (after 8.1.0) with their WP4 configuration, but it looks like require.resolve() is being passed through without modification. abhinaba-ghosh/cypress-react-selector#230. I tried to unplug the references package, but to no avail.
arcanis — Today at 2:32 PM
What is cy.readFile ? A native function ?
francisu — Today at 2:47 PM
Just a cypress command: https://docs.cypress.io/api/commands/readfile. but the point is it's trying to read from the wrong path, right?
@arcanis
arcanis — Today at 2:50 PM
No, it likely means that it doesn't know how to access the file from within its zip archives
Since the Node fs layer is supposed to support it transparently, it means Cypress is doing something special
Why cy.readFile? Why not fs.readFile?
francisu — Today at 3:15 PM
@arcanis ahh, I see, I was not aware that node fs did this. It ultimately uses fs-extra, which i assume works the same. But it's suspicious that the error is a ENOTDIR. Anyways, it looks like this does not have to do with PnP, so thanks for your help, and I will try and debug it from here.
arcanis — Today at 3:17 PM
Node doesn't do this naturally - it's our custom layer that tells it how to load those files
Without it, the ENOTDIR is expected since foo.zip is in fact not a dir
Now as to why it doesn't work with Cypress, I don't know - never used it myself. Perhaps fs-extra gets executed before our loader can inject the zip support layer ?
The text was updated successfully, but these errors were encountered: