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

My linter configuration throw errors because commands from cypress-testing-library seem to be not working properly. #229

Open
NicoMoli opened this issue Aug 30, 2022 · 4 comments

Comments

@NicoMoli
Copy link

NicoMoli commented Aug 30, 2022

  • cypress-testing-library version: 8.0.3
  • node version: 14.19.0
  • npm (or yarn) version: I am using pnpm version 7.2.1

Relevant code or config

Print screen of my cypress/support/command.js

Captura de Pantalla 2022-08-30 a la(s) 09 48 58

What you did:

I am trying to use Cypress with cypress-testing-library (the entire project is using typescript).

What happened:

When I am trying to use, for example findByRole query I obtain this linter error.

Captura de Pantalla 2022-08-30 a la(s) 09 50 37

Problem description:

The cypress components tests are able to run successfully but my linter config is no very happy about it.

@dimas-cyriaco
Copy link

I'm having the same problem.

@mpaternostro
Copy link

Was having the same problem after following setup from cypress-testing-library docs, solved it by adding a reference comment like so:

/// <reference types="cypress" />
/// <reference types="@testing-library/cypress" />
/// add this at the top of your test files 👆

Hope it solves your problem!

@NicoMoli
Copy link
Author

NicoMoli commented Sep 9, 2022

Thanks Marcelo. I am gonna to try your solution.

@srflp
Copy link

srflp commented Nov 19, 2022

If you're using TypeScript, just add @testing-library/cypress to your tsconfig.json under compilerOptions.types like this:

{
  "compilerOptions": {
    ...
    "types": [..., "@testing-library/cypress"]
  }
}

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

4 participants