Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(cy.stub): Update syntax to use callsFake() instead of deprecated third argument #5955

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions docs/api/commands/stub.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ assertion. It is not retryable, chainable, or timeout-able.
```javascript
cy.stub()
cy.stub(object, method)
cy.stub(object, method, replacerFn)
```

### Usage
Expand All @@ -41,10 +40,6 @@ The `object` that has the `method` to be replaced.

The name of the `method` on the `object` to be wrapped.

<Icon name="angle-right" /> **replacerFn _(Function)_**

The function used to replace the `method` on the `object`.

### Yields [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Subject-Management) {#Yields}

- `cy.stub()` is _synchronous_ and returns a value (the stub) instead of a
Expand Down Expand Up @@ -82,7 +77,7 @@ expect(util.addListeners).to.be.called
// assume App.start calls util.addListeners
let listenersAdded = false

cy.stub(util, 'addListeners', () => {
cy.stub(util, 'addListeners').callsFake(() => {
listenersAdded = true
})

Expand Down