Skip to content

Allow plugin authors to extend the Cypress config types #22127

@Lakitna

Description

@Lakitna

What would you like?

The ability for extension authors to extend the types used in the defineConfig function when configuring Cypress via cypress.config.ts (or, to a lesser extent, cypress.config.js).

Why is this needed?

I am the author of cypress-commands which adds a few new commands and extends some others.

One of the extended commands also adds a new property to the config file. In this case, the extended cy.request() uses the requestBaseUrl config property. Details on the command: https://github.com/Lakitna/cypress-commands/blob/develop/docs/request.md

I have tried to extend it using the same approach as with adding commands to the types. It does not work as-is, the type validation keeps throwing errors.

Other

To make things seamless for users, I want to refrain from using/recommending workarounds like:

  • Directly export the config without using defineConfig. This skips the type checks.
  • Use cypress.config.js instead of .ts. This skips the type checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementRequested enhancement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions