diff --git a/cli/types/cypress-eventemitter.d.ts b/cli/types/cypress-eventemitter.d.ts index 3e6e39800fa1..86d2587f722b 100644 --- a/cli/types/cypress-eventemitter.d.ts +++ b/cli/types/cypress-eventemitter.d.ts @@ -1,7 +1,7 @@ // Cypress, cy, Log inherits EventEmitter. type EventEmitter2 = import("eventemitter2").EventEmitter2 -interface EventEmitter extends EventEmitter2 { +interface CyEventEmitter extends Omit { proxyTo: (cy: Cypress.cy) => null emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any> emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic diff --git a/cli/types/cypress-global-vars.d.ts b/cli/types/cypress-global-vars.d.ts index d108bfa3c7f7..ddeaa326a9ef 100644 --- a/cli/types/cypress-global-vars.d.ts +++ b/cli/types/cypress-global-vars.d.ts @@ -7,7 +7,7 @@ cy.get('button').click() cy.get('.result').contains('Expected text') ``` */ -declare const cy: Cypress.cy & EventEmitter +declare const cy: Cypress.cy & CyEventEmitter /** * Global variable `Cypress` holds common utilities and constants. @@ -19,4 +19,4 @@ Cypress.version // => "1.4.0" Cypress._ // => Lodash _ ``` */ -declare const Cypress: Cypress.Cypress & EventEmitter +declare const Cypress: Cypress.Cypress & CyEventEmitter diff --git a/cli/types/tests/actions.ts b/cli/types/tests/actions.ts index 014c43dad9da..831aaee0fe84 100644 --- a/cli/types/tests/actions.ts +++ b/cli/types/tests/actions.ts @@ -87,3 +87,18 @@ namespace CypressActionCommandOptionTests { cy.get('el').click({scrollBehavior: false}) cy.get('el').click({scrollBehavior: true}) // $ExpectError } + +// https://github.com/cypress-io/cypress/pull/21286 +// `waitFor` doesn't exist in Node EventEmitter +// and it confuses the users with `cy.wait` +namespace CyEventEmitterTests { + cy.waitFor() // $ExpectError + cy.on('random', () => {}) + cy.removeAllListeners() + cy.removeListener('a', () => {}) + + Cypress.waitFor() // $ExpectError + Cypress.on('random', () => {}) + Cypress.removeAllListeners() + Cypress.removeListener('a', () => {}) +}