add Cypress.sinon type (#6725)

This commit is contained in:
Gleb Bahmutov
2020-03-16 09:17:05 -04:00
committed by GitHub
parent d17a1b3372
commit 333ab85324
2 changed files with 16 additions and 0 deletions
+9
View File
@@ -207,6 +207,15 @@ declare namespace Cypress {
* new Cypress.Promise((resolve, reject) => { ... })
*/
Promise: Bluebird.BluebirdStatic
/**
* Cypress includes Sinon.js library used in `cy.spy` and `cy.stub`.
*
* @see https://sinonjs.org/
* @see https://on.cypress.io/stubs-spies-and-clocks
* @see https://example.cypress.io/commands/spies-stubs-clocks
*/
sinon: sinon.SinonApi
/**
* Cypress version string. i.e. "1.1.2"
* @see https://on.cypress.io/version
+7
View File
@@ -13,6 +13,13 @@ namespace CypressMomentTests {
Cypress.moment().startOf('week') // $ExpectType Moment
}
namespace CypressSinonTests {
Cypress.sinon // $ExpectType SinonApi
const stub = cy.stub()
stub(2, 'foo')
expect(stub).to.have.been.calledWith(Cypress.sinon.match.number, Cypress.sinon.match('foo'))
}
namespace CypressJqueryTests {
Cypress.$ // $ExpectType JQueryStatic
Cypress.$('selector') // $ExpectType JQuery<HTMLElement>