-
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 3 + cypress.config.ts does not work #25958
Comments
@lmiller1990 have you solved it? |
Summary: Update Cypress from 9.x to 12.x, and perform all relevant migrations. Changes are the results of [10.0 migration](https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-100), [11.0 migration](https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-110), and [12.0 migration](https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-120) guides. The reason for using `cypress.config.mjs` instead of `cypress.config.ts` is that the latter is not working with Yarn 3 yet ([1](cypress-io/cypress#24209), [2](cypress-io/cypress#22747), [3](cypress-io/cypress#25958)). If that changes, we can revisit. Notably, one of the larger changes is that test isolation is now on by default. This means the page is refreshed between each test rather than each suite, so some tests needed to be reconfigured to work with that paradigm. Cypress' UI has gotten a major refresh as well, so I changed the commands to account for it. Relevant Issues: N/A Type of change: /kind cleanup Test Plan: Follow instructions in `src/ui/cypress/README.md`. In particular, try `yarn run cypress:run:chrome`. All of the tests should pass, totally headlessly. Signed-off-by: Nick Lanam <[email protected]>
I don't think so, but there are work arounds. Those don't work for you? |
I got this to work without changing my cypress.config.ts by using ts-import.
I created a cypress.config.js with the following contents: // eslint-disable-next-line @typescript-eslint/no-var-requires
const { loadSync, LoadMode } = require('ts-import');
module.exports = loadSync('./cypress.config.ts', { mode: LoadMode.Compile, useCache: false }); And then updated cypressConfig to point to cypress.config.js instead. Note: I doubt using ts-import is the way to go to fix this problem internally, especially given the weird caching behavior. But at least allowed me to migrate to Yarn 3 PnP w/o losing TS support in my config files. |
After a couple of months of using the Yarn PnP actively, I've had several issues that made it not worth our while and reverted back to the node-modules mode. I hope you have a better and productive time with it. |
…ersion in sample project (cypress-realworld-app) See cypress-io/cypress#25958
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. |
Ref: #22747 -> #22747 (comment)
If you are using Yarn 3 with TypeScript and have a
cypress.config.ts
, it will error when opening Cypress, no matter what. You cannot work around the issue. The only fix would be to usejs
ormjs
extensions. There's an example here: #25959Repro: yarn3.zip
Ideally, we should correctly consume the
cypress.config.ts
using the strategy we use for any package manager other than Yarn 3, which seems to work great. Based on some research, this may not be possible (or maybe it is?) using our current strategy, which uses loader API for ESM and require API for CJS. I suspect the CJS might be easier to work out.type: module
does--loader
cypress/packages/data-context/src/data/ProjectConfigIpc.ts
Line 292 in 0cdd8d1
--require
cypress/packages/data-context/src/data/ProjectConfigIpc.ts
Line 306 in 0cdd8d1
Neither works with TS and Yarn 3.
May be relevant: yarnpkg/berry#4044
The text was updated successfully, but these errors were encountered: