nx icon indicating copy to clipboard operation
nx copied to clipboard

fix(testing): include cypress commands in tsconfig

Open yjaaidi opened this issue 3 years ago • 2 comments

closes #12148

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #

yjaaidi avatar Sep 21 '22 11:09 yjaaidi

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)

vercel[bot] avatar Sep 21 '22 11:09 vercel[bot]

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.

barbados-clemens avatar Sep 23 '22 16:09 barbados-clemens

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 avatar Sep 23 '22 18:09 yjaaidi

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 avatar Sep 23 '22 18:09 yjaaidi

@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.

barbados-clemens avatar Sep 23 '22 21:09 barbados-clemens

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.

yjaaidi avatar Sep 25 '22 13:09 yjaaidi

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.

barbados-clemens avatar Sep 26 '22 13:09 barbados-clemens

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.

github-actions[bot] avatar Mar 17 '23 18:03 github-actions[bot]