-
Notifications
You must be signed in to change notification settings - Fork 153
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
When I run TypeScript lint, it doesn't seem to be recognizing cypress-testing-library commands #227
Comments
Hi guys! I have been fighting with the same problem! Could you help me |
+1 |
Hi even I observe the same error when I run my scripts in browserStack. Any alternatives or fix for this please? Running: movSvc/testCaseCheckTest.spec.js Oops...we found an error preparing this test file: cypress\support\index.js The error was: Error: Webpack Compilation Error |
When I try to run my test in a typescript project, am getting the error below, need assistance
the tests run without @testing-library/cypress in command.ts and e2e.ts |
I followed the installations steps and I have the same problem. Whithout the import @testing-library/cypress works but with no testing library dom functions. next 12.2.4 |
One solution worked for me. Use reference comments on the top of your test files: |
Another solution is as per https://zudemwango.medium.com/how-to-setup-cypress-testing-library-cypress-with-typescript-ac401a604d74 and i just added |
Worked like a charm! |
cypress-testing-library
version: 8.0.3node
version: 16.15.0npm
version: 8.5.5Relevant code or config:
tsconfig.json file
At top of spec files I am trying to lint, I have put the following code:
// @ts-check
in commands.js I have included
What you did:
I am following Gleb's instructions on converting Cypress from JavaScript to TypeScript. So all my files are still .js but I have it set up for TypeScript to check types as seen above. I'm now running the lint command on a few of my spec files to see what errors occur. I am doing the lint via a script that runs the command line:
tsc --noEmit --pretty --allowJs --resolveJsonModule
What happened:
I received type errors for cypress-testing-library commands:
Property 'findByRole' does not exist on type 'cy & CyEventEmitter'.
Property 'findByLabelText' does not exist on type 'cy & CyEventEmitter'
This is for all occurrences of those methods in the spec file
Problem description:
I followed the setup given on this GitHub for getting typescript to work with cypress-testing-library, so I would expect these types to be recognized.
Suggested solution:
Not sure - maybe I am missing something obvious in the set-up?
The text was updated successfully, but these errors were encountered: