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

Add a definitions file for Cypress custom commands #9129

Open
2 tasks done
archibald1418 opened this issue Feb 20, 2025 · 0 comments
Open
2 tasks done

Add a definitions file for Cypress custom commands #9129

archibald1418 opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request tests

Comments

@archibald1418
Copy link
Contributor

archibald1418 commented Feb 20, 2025

Actions before raising this issue

  • I searched the existing issues and did not find anything similar.
  • I read/searched the docs

Is your feature request related to a problem? Please describe.

At the moment, our Cypress custom commands don't get autocomplete and typehints in VSCode.
The commands are not recognized by the ide, to pick a command developer has to manually search by exact command names in the project.

Describe the solution you'd like

Generate a index.d.ts file and autoupdate it on save with the help of CypressHelper VSCode extension (which is recommended by Cypress docs).

This will only require installing CypressHelper to VSCode and updating .vscode/settings.json with

{
  "cypressHelper.typeDefinitionOnSave": true,
  "cypressHelper.customCommandsFolder": "tests/cypress/support",
  "cypressHelper.typeDefinitionFile": "tests/cypress/support/index.d.ts",
}

and adding /// <reference types="../../support/index.d.ts" /> to a file to enable hints

This simple update will not require us to rewrite all tests to typescript, but this will make VSCode recognise latest list of commands and offer them to the developer in dropdown menus (todo: drop a gif with demo).

Describe alternatives you've considered

No response

Additional context

No response

@archibald1418 archibald1418 added the enhancement New feature or request label Feb 20, 2025
@archibald1418 archibald1418 changed the title Add a definitions file for Cypress Add a definitions file for Cypress custom commands Feb 20, 2025
@archibald1418 archibald1418 self-assigned this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tests
Projects
None yet
Development

No branches or pull requests

1 participant