nx
nx copied to clipboard
fix(testing): include cypress commands in tsconfig
closes #12148
Current Behavior
Expected Behavior
Related Issue(s)
Fixes #
☁️ Nx Cloud Report
CI is running/has finished running commands for commit fab3c13477be542d865da6d75470cb359efcc6e5. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this branch
✅ Successfully ran 12 targets
nx affected --target=e2e --base=75115e100a5934372ace9a355ed4ec5ec93d812b --head=fab3c13477be542d865da6d75470cb359efcc6e5 --exclude=e2e-storybook,e2e-storybook-angular,e2e-react-native,e2e-detox,e2e-make-angular-cli-faster --parallel=1nx affected --target=test --base=75115e100a5934372ace9a355ed4ec5ec93d812b --head=fab3c13477be542d865da6d75470cb359efcc6e5 --parallel=1nx affected --target=build --base=75115e100a5934372ace9a355ed4ec5ec93d812b --head=fab3c13477be542d865da6d75470cb359efcc6e5 --parallel=3nx-cloud record -- yarn depchecknx affected --target=lint --base=75115e100a5934372ace9a355ed4ec5ec93d812b --head=fab3c13477be542d865da6d75470cb359efcc6e5 --parallel=3nx-cloud record -- yarn nx workspace-lintnx-cloud record -- yarn check-lock-filesnx-cloud record -- yarn check-commitnx-cloud record -- yarn nx format:check --base=75115e100a5934372ace9a355ed4ec5ec93d812b --head=fab3c13477be542d865da6d75470cb359efcc6e5nx-cloud record -- yarn check-importsnx-cloud record -- yarn documentationnx build typedoc-theme
Sent with 💌 from NxCloud.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
| Name | Status | Preview | Updated |
|---|---|---|---|
| nx-dev | ⬜️ Ignored (Inspect) | Sep 21, 2022 at 11:53AM (UTC) |
Hi @yjaaidi I tested locally and for me it "just worked" without having to change the tsconfig.cy.json.
This is because under the hood cypress uses its own tsconfig that should include all support files.
I'm find with merging it if it fixes things on your end, as it has no adverse affects either. just wanted to let you know.
Oh! Interesting. Actually, it "worked" on my end too due to the Cypress override but IDEs are not happy with that because the support files are excluded from the tsconfig solution.
Is that right?
Thank you for the approval.
Oh! Interesting. Actually, it "worked" on my end too due to the Cypress override but IDEs are not happy with that because the support files are excluded from the tsconfig solution.
Is that right?
Thank you for the approval.
@yjaaidi Oh interesting. I haven't seen that. What editor are you using? I've tried webstorm/vscode and not seen the error. Are you using in an app or lib? sometimes there's an issues with jest + cypress types colliding, but that doesn't sound like this error.
I didn't try on a lib yet but I tried on both WebStorm & VSCode. I was able to reproduce this from scratch like this:
yarn create nx-workspace --preset angular --appName demo
nx g @nrwl/angular:cypress-component-configuration --project=demo --generateTests
then call cy.login('', '') in the generated app.component.cy.ts
Are you able to reproduce it?
Also, you are right about the jest / cypress conflict.
I had it fixed in my workspace https://github.com/marmicode/whiskmate/blob/testing-23-visual-regression-testing/apps/whiskmate/tsconfig.editor.json by excluding cypress/**/*.ts and **/*.cy.ts in the tsconfig.editor.json when using Cypress 9 + @jscutlery/cypress-angular (I think we had an issue open to add it to our generator https://github.com/jscutlery/devkit/tree/main/packages/cypress-angular/src/generators/setup-ct)
As you raised the issue again, I checked and I noticed that the "exclude" is not enough.
I had to replace include: **/*.ts by include: src/**/*.ts even if cypress/**/*.ts and **/*.cy.ts are excluded.
BTW, I wonder if tsconfig.editor.json is really needed as typing works great thanks to all other tsconfigs when tsconfig.editor.json is removed.
Ah yes, now i'm gettin the error. Thanks!
for tsconfig.editor.json should be safe to delete it. I haven't ran into any issues with removing it.
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.