Skip to content
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

Importing code from this library makes VS Code show types conflict between Jest and Cypress #1095

Closed
3 tasks done
zilia-gmethot opened this issue Sep 12, 2023 · 1 comment
Closed
3 tasks done

Comments

@zilia-gmethot
Copy link

Current behavior

This issue is a duplicate from another one I created in a different repo but I would like your input on the matter.

Importing code from this library in a Cypress component test file makes VS Code's TypeScript Language Server show typing errors in the Jest test files of my project. TypeScript configuration files seems to be configured appropriately and I get no runtime errors.

I'm assuming the problem comes from the fact that your tsconfig.json contains "types": ["cypress"] but I don't understand why this would affect the Jest test files of my project which have their specific TypeScript configuration to avoid typing conflicts with Cypress.

Desired behavior

I would like to be able to use this library without causing typing conflicts between Jest and Cypress.

Test code to reproduce

Here is a repository that replicates the issue: https://github.com/zilia-gmethot/jest-cypress-conflict.

  1. Open the repository with the latest version of VS Code
  2. Open the file apps/frontend-device/src/app/app.component.spec.ts and notice the typing errors.
  3. Open the file apps/frontend-device/src/app/app.component.cy.ts and comment out line 3, which contains import '@badeball/cypress-cucumber-preprocessor';
  4. Open the file apps/frontend-device/src/app/app.component.spec.ts and notice that the typing errors are gone.

Versions

  • Cypress version: 12.17.4
  • Preprocessor version: 18.0.5
  • Node version: 16.19.0

Checklist

  • I've read the FAQ.
  • I've read instructions for logging issues.
  • I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).
@badeball
Copy link
Owner

This isn't something I can help you with. Jest and Cypress' types are just conflicting. See cypress-io/cypress#22059 and https://docs.cypress.io/guides/component-testing/faq#How-do-I-get-TypeScript-to-recognize-Cypress-types-and-not-Jest-types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants