testing-library / cypress-testing-library

🐅 Simple and complete custom Cypress commands and utilities that encourage good testing practices.
http://npm.im/@testing-library/cypress
MIT License
1.8k stars 152 forks source link

Property 'findByTestId' does not exist on type 'cy & CyEventEmitter' - only in .cy.tsx (component testing) files #271

Open egucciar opened 7 months ago

egucciar commented 7 months ago

Problem description:

I have cypress types working and configured in tsconfig.json, however, the type does not appear to work outside of the /cypress folder.

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "types": [
      "cookie-session",
      "cypress",
      "node",
      "cypress-real-events",
      "cypress-wait-until",
      "@testing-library/cypress",
      "@cypress/grep",
      "webpack-env"
    ]
  },
  "exclude": ["**/*.test.tsx", "**/*.test.ts", "**/__tests__", "common/test-utils"],
  "include": [
    "./cypress.config.ts",
    "cypress",
    "**/*.cy.tsx",
    "**/*.d.ts",
    "webapp/src",
    "ui",
    "common",
    "./**/*.json",
    "webapp/Config.ts"
  ]
}
MatanBobi commented 7 months ago

I'm transferring this to the cypress-testing-library repo :)