Skip to content

Commit 7f2dcf1

Browse files
Update "Replace a method with a function" (#5592)
The `replacerFn` parameter is deprecated, with a recommendation to use `callsFake` instead. Co-authored-by: Jennifer Shehane <[email protected]>
1 parent 25994e5 commit 7f2dcf1

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

docs/api/commands/stub.mdx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ assertion. It is not retryable, chainable, or timeout-able.
1919
```javascript
2020
cy.stub()
2121
cy.stub(object, method)
22-
cy.stub(object, method, replacerFn)
2322
```
2423

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

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

44-
<Icon name="angle-right" /> **replacerFn _(Function)_**
45-
46-
The function used to replace the `method` on the `object`.
47-
4843
### Yields [<Icon name="question-circle"/>](/app/core-concepts/introduction-to-cypress#Subject-Management) {#Yields}
4944

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

85-
cy.stub(util, 'addListeners', () => {
80+
cy.stub(util, 'addListeners').callsFake(() => {
8681
listenersAdded = true
8782
})
8883

0 commit comments

Comments
 (0)