diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index 6f8aa4629c84..7786c0c3a660 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -327,6 +327,12 @@ declare namespace Cypress { */ on: Actions + /** + * These events come from Cypress as it issues commands and reacts to their state. These are all useful to listen to for debugging purposes. + * @see https://on.cypress.io/catalog-of-events#App-Events + */ + once: Actions + /** * These events come from Cypress as it issues commands and reacts to their state. These are all useful to listen to for debugging purposes. * @see https://on.cypress.io/catalog-of-events#App-Events @@ -934,6 +940,12 @@ declare namespace Cypress { */ on: Actions + /** + * These events come from Cypress as it issues commands and reacts to their state. These are all useful to listen to for debugging purposes. + * @see https://on.cypress.io/catalog-of-events#App-Events + */ + once: Actions + /** * These events come from Cypress as it issues commands and reacts to their state. These are all useful to listen to for debugging purposes. * @see https://on.cypress.io/catalog-of-events#App-Events diff --git a/cli/types/tests/cypress-tests.ts b/cli/types/tests/cypress-tests.ts index 13838bc77418..7b7ccb23eb09 100644 --- a/cli/types/tests/cypress-tests.ts +++ b/cli/types/tests/cypress-tests.ts @@ -246,6 +246,18 @@ namespace CypressOnTests { }) } +namespace CypressOnceTests { + Cypress.once('uncaught:exception', (error, runnable) => { + error // $ExpectType Error + runnable // $ExpectType IRunnable + }) + + cy.once('uncaught:exception', (error, runnable) => { + error // $ExpectType Error + runnable // $ExpectType IRunnable + }) +} + namespace CypressOffTests { Cypress.off('uncaught:exception', (error, runnable) => { error // $ExpectType Error