Cypress · Function
cy.stub
cy.stub() replaces a function with a Sinon stub. It records calls and lets you control the function's behavior, such as its return value or thrown error.
Last updated
- Since
- 0.18.8
Syntax
cy.stub()
cy.stub(object, method)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
.as()cy.clock()cy.spy()Stubs, spies, and clocks