Closed munkinugget closed 1 year ago
@munkinugget Thank you for posting this issue and attaching a reproducible project.
After cloning your project and following your setup instructions, I was able to obtain the same error as you posted.
Upon further investigation, it seems like the packages/cypress-tests
folder contained a cypress.config.ts
file which was the file that was causing this error.
What was irregular in the repository is that you have a cypress.config.ts
file but do not have a cypress
folder within your packages/cypress-tests
which would contain support files and other important files used by cypress.
The work around to avoid the problem above is:
cypress.config.ts
and the tsconfig.json
files within the packages/cypress-tests
folder.tsconfig.json
. You can use this link https://docs.cypress.io/guides/tooling/typescript-support#Install-TypeScript to change the typescript config file based on Cypress recommendations.)npx cypress open
, the Cypress Desktop GUI will be launched guiding you through a quick installation process which will automatically scaffold all the files necessary to run Cypress automatically. This includes the cypress.config.ts
file. yarn test
does open Cypress correctly.I followed the steps above to get the typescript project working with cypress.
Closing as resolved.
If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.
Dang, I did not catch this before you closed it. I cannot replicate your solution. Would you be willing to share the working tsconfig.json? I'm not sure what I'm doing wrong.
@munkinugget After going over this issue again it seems as though my solution does not entirely solve the typescript errors associated with cypress in your Yarn 3 project.
For the time being it seems as though Yarn 3 is not correctly handling tsconfig
types correctly as you will see in this issue and here. This is why you see the NODE_Options
errors in your console
because the node
types have not be recognized correctly.
I am looking further into this and hopefully should find a work around for Cypress
Related issue: issue-19229
Hey @munkinugget we have a few issues related to pnp
. This one is the current 'main' issue https://github.com/cypress-io/cypress/issues/22747. I'm going to close this for now. Feel free to re-open if you think they aren't related!
Current behavior
This project is a monorepo using Yarn 3, with PnP / zero install, with yarn workspaces. In this environment the minimum settings suggested by your documentation to configure and run cypress with Typescript fails with the following errors:
In the console:
Within the Cypress UI (Stack trace):
Desired behavior
Cypress should launch without this error.
Test code to reproduce
You will need a Node ^16 environment with Yarn installed.
Clone my repo: https://github.com/munkinugget/cypress-ts-repro
Run the yarn command once to insure everything is running ok:
yarn
Run the following command in the repo directory:
yarn test
It will launch cypress, and you should see the error messages in the console and in the app UI.
Cypress Version
10.9.0
Node version
16.17.0
Operating System
macOS 12.6
Debug Logs
Other
I've been troubleshooting this issue for a while now and can't seem to move past this. I'm trying to move my project to Yarn PnP and zero installs, and this is the last hangup. Any help or insight would be greatly appreciated.