Open wakaztahir opened 1 year ago
Adding my voice to the group. Experiencing this with latest version of Cypress (^13.0.0).
Our setup is using NX to create an single Angular application. We then set up Yarn PnP, and then ran the cypress command to configure component tests (yarn nx g @nx/angular:cypress-component-configuration --project=my-project --build-target=my-projectr:build
).
We then get this
[50088:0921/113920.188:ERROR:node_bindings.cc(300)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.
Followed by this
DevTools listening on ws://127.0.0.1:53068/devtools/browser/60158d19-8ee0-4092-bc24-6df5ffca7643
Your configFile is invalid: C:\Projects\***\cypress.config.ts
It threw an error when required, check the stack trace below:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Projects\***\cypress.config.ts
at new NodeError (node:internal/errors:405:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
at defaultLoad (node:internal/modules/esm/load:91:20)
at nextLoad (node:internal/modules/esm/hooks:733:28)
at load$1 (file:///C:/***/.pnp.loader.mjs:1456:12)
at nextLoad (node:internal/modules/esm/hooks:733:28)
at Hooks.load (node:internal/modules/esm/hooks:377:26)
at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20)
I've created a very basic repro repo: https://github.com/AStoker/nx-angular-yarnpnp-cypress-bug
Steps:
npx create-nx-workspace@latest
yarn set version stable
yarn config set nodeLinker pnp
yarn add -D @angular-devkit/architect
(looks like this is a different problem with cypress where it's just not being included correctly)yarn install
yarn nx e2e e2e
(observe the error)@AStoker
I see that your issue is reproducible using Yarn Modern Plug'n'Play and if the repo is switched to nodeLinker: node-modules
the problem does not occur. Cypress does not work at all with Yarn Modern Plug'n'Play and component testing. See https://github.com/cypress-io/cypress-documentation/issues/5394. It seems that there are also challenges here with E2E type testing.
@wakaztahir
Which version of Yarn are you using and if it is Yarn Modern, which nodeLinker
mode do you use?
@MikeMcC399 I was using yarn 1.5.1, I've upgraded to Yarn Modern and I also started using JS file instead as a workaround
@wakaztahir
I was using yarn 1.5.1, I've upgraded to Yarn Modern and I also started using JS file instead as a workaround
Thanks for the feedback and update! Yarn 1.5.1
is quite an old version of Yarn Classic, which is currently at version 1.22.19
. I wonder if that also contributed to the problem with .ts
? I guess it's not necessary to answer that question though, since @AStoker already provided a full reproducible example of the issue for the Cypress team to look at.
@MikeMcC399 as long as its working with the latest version, I don't have a problem
@MikeMcC399 , is that something that is on the roadmap to work on?
@AStoker
is that something that is on the roadmap to work on?
I'm not sure exactly what you are referring to, however I should say that I'm just a community member, not a representative of Cypress.
This issue has been reviewed but not otherwise worked on by a member of the Cypress team. Since it has not been rejected nor has it been given the label of a feature request then I would understand it as a candidate for further triaging.
i think this is a duplicate of https://github.com/cypress-io/cypress/issues/22747 (which i'm eagerly awaiting)
Having this issue and the only way I was able to resolve it was by downgrading to TypeScript v5.2.2.
I'm using Cypress v13.6.0 and Yarn 1.22.19.
Having this issue and the only way I was able to resolve it was by downgrading to TypeScript v5.2.2.
I'm using Cypress v13.6.0 and Yarn 1.22.19.
This worked for me - sigh.
Having this issue and the only way I was able to resolve it was by downgrading to TypeScript v5.2.2.
I'm using Cypress v13.6.0 and Yarn 1.22.19.
This also worked for me. Typescript 5.3 or greater causes issues for some reason...
https://yarnpkg.com/configuration/yarnrc#nodeLinker
In .yarnrc.yml
nodeLinker: node-modules
This solved my issue.
Using yarn v4.0.2 Cypress v13.6.0, Typescript 5.3.3
in a Vite + VueJS Setup.
Having this issue and the only way I was able to resolve it was by downgrading to TypeScript v5.2.2.
I'm using Cypress v13.6.0 and Yarn 1.22.19.
Same here. Does anybody know what specifically in TS 5.3 is breaking cypress functionality to read the config?
Having same issue on GitHub action only, workflow log: https://github.com/hbstack/announcement-bar/actions/runs/9239217450/job/25418111856.
It's weird that everything is OK on local development.
Seeing same issue after updating typescript from 5.0. to 5.5
I'm getting the same error, but it only happens when I use extends
at tsconfig.base.json, for example:
tsconfig.base.json
{
"compilerOptions": {
...
},
"extends": ["@tsconfig/strictest/tsconfig.json"] // it works fine removing this line
}
apps/ui-e2e/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "cypress.config.ts"]
}
Using Cypress v13.10.0, Typescript 5.4.5 in a Nx monorepo.
Just to add my fix for this. It turned out it came from trying to consume files using ESM syntax instead of CJS. I have a bunch of commands/plugins that are published to a separate package and I import some of those into the config file.
Recently changed those to build as esm
via Rollup, but ended up in this error. Changing it back to cjs
fixed things.
Somewhat related to https://github.com/cypress-io/cypress/issues/22747 I believe
Current behavior
package.json
cypress.config.ts
error
tsconfig.json
tsconfig.build.json
tsconfig.tests.json
Desired behavior
Cypress should run all the tests since typescript is installed, Its a monorepo, The issue occurs even after yarn install after deleting the yarn lock file, I've tried everything in other issues but issue doesn't seem to resolve, however changing the
type
field inpackage.json
does change the output of the errorTest code to reproduce
Currenlty the project is huge, Requires a bit of work to reproduce
Cypress Version
v12.17.2
Node version
v18.12.1
Operating System
Windows 11
Debug Logs
No response
Other
No response