cypress-testing-library
cypress-testing-library copied to clipboard
Cannot import `ByRoleMatcher` (and others) from @testing-library/cypress
-
cypress-testing-libraryversion: 8.0.7 -
nodeversion: v18.12.1 -
pnpmversion: 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
ByRoleMatcherfrom@testing-library/cypress - mark
@testing-library/domas 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/domto have access to all of the types