mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-21 14:40:05 -05:00
Fix the cy.stub type signature (#4302)
* Fix the cy.stub type signature * Fix the TS linter failures
This commit is contained in:
committed by
Zach Bloomquist
parent
717ad26350
commit
d55acdee2e
Vendored
+5
-3
@@ -1785,7 +1785,7 @@ declare namespace Cypress {
|
||||
writeFile<C extends FileContents>(filePath: string, contents: C, encoding: Encodings, options?: Partial<Loggable>): Chainable<C>
|
||||
}
|
||||
|
||||
interface Agent<A extends sinon.SinonSpy> {
|
||||
interface SinonSpyAgent<A extends sinon.SinonSpy> {
|
||||
log(shouldOutput?: boolean): Omit<A, 'withArgs'> & Agent<A>
|
||||
|
||||
/**
|
||||
@@ -1809,6 +1809,8 @@ declare namespace Cypress {
|
||||
withArgs(...args: any[]): Omit<A, 'withArgs'> & Agent<A>
|
||||
}
|
||||
|
||||
type Agent<T extends sinon.SinonSpy> = SinonSpyAgent<T> & T
|
||||
|
||||
interface CookieDefaults {
|
||||
whitelist: string | string[] | RegExp | ((cookie: any) => boolean)
|
||||
}
|
||||
@@ -3978,7 +3980,7 @@ declare namespace Cypress {
|
||||
})
|
||||
```
|
||||
*/
|
||||
(action: 'window:confirm', fn: ((text: string) => false | void) | Agent<sinon.SinonSpy> | Agent<sinon.SinonStub>): void
|
||||
(action: 'window:confirm', fn: ((text: string) => false | void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>): void
|
||||
/**
|
||||
* Fires when your app calls the global `window.alert()` method.
|
||||
* Cypress will auto accept alerts. You cannot change this behavior.
|
||||
@@ -3995,7 +3997,7 @@ declare namespace Cypress {
|
||||
```
|
||||
* @see https://on.cypress.io/catalog-of-events#App-Events
|
||||
*/
|
||||
(action: 'window:alert', fn: ((text: string) => void) | Agent<sinon.SinonSpy> | Agent<sinon.SinonStub>): void
|
||||
(action: 'window:alert', fn: ((text: string) => void) | SinonSpyAgent<sinon.SinonSpy> | SinonSpyAgent<sinon.SinonStub>): void
|
||||
/**
|
||||
* Fires as the page begins to load, but before any of your applications JavaScript has executed. This fires at the exact same time as `cy.visit()` `onBeforeLoad` callback. Useful to modify the window on a page transition.
|
||||
* @see https://on.cypress.io/catalog-of-events#App-Events
|
||||
|
||||
Reference in New Issue
Block a user