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

Cannot import ByRoleMatcher (and others) from @testing-library/cypress #242

Open
srflp opened this issue Nov 19, 2022 · 0 comments
Open

Comments

@srflp
Copy link

srflp commented Nov 19, 2022

  • cypress-testing-library version: 8.0.7
  • node version: v18.12.1
  • pnpm version: 7.16.1

My package.json

  "devDependencies": {
    "@faker-js/faker": "^7.6.0",
    "@testing-library/cypress": "^8.0.3",
    "@typescript-eslint/eslint-plugin": "^5.43.0",
    "@typescript-eslint/parser": "^5.43.0",
    "cypress": "^11.1.0",
    "eslint": "^8.27.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-cypress": "^2.12.1",
    "husky": "^8.0.2",
    "lint-staged": "^13.0.3",
    "prettier": "^2.7.1",
    "typescript": "~4.8.4"
  },
  "dependencies": {}

I wanted to import ByRoleMatcher type from @testing-library/cypress, since this type is used as an argument type for findByRole(id: ByRoleMatcher, options?: ByRoleOptions) function from @testing-library/cypress.

Problem:

ByRoleMatcher is used by @testing-library/cypress but is not exported by it. And I want to use this type in my project.

Suggested solutions:

  • reexport ByRoleMatcher from @testing-library/cypress
  • mark @testing-library/dom as a peer dependency (I'm not sure if it would fix it)
  • inform TypeScript users that they should also npm/yarn/pnpm install -D @testing-library/dom to have access to all of the 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

1 participant