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

Conversation

sadie100
Copy link

While using Cypress, I encountered a deprecated notice when following the official documentation for cy.stub(object, method, replacerFn). Upon investigation, I found that this syntax has been deprecated in Sinon.JS since version 3.0.0. As Cypress is currently using Sinon.JS version 7.3.2(as per package.json), I determined that this was a deprecated specification.

So I made changes in document:

  1. Removed the deprecated cy.stub(object, method, replacerFn) syntax from the documentation.
  2. Updated related examples to use the new recommended syntax cy.stub(object, method).callsFake(replacerFn).

These changes will help Cypress users write more up-to-date and future-proof test code, avoiding potential deprecation warnings or errors.

Please review and let me know if any further changes or clarifications are needed.

… third argument

Update cy.stub() documentation to reflect the latest Sinon.JS syntax:
- Remove deprecated `cy.stub(object, method, replacerFn)` syntax
- Add `cy.stub(object, method).callsFake(replacerFn)` as the recommended approach
- Update related examples to use the new syntax

This change aligns the Cypress documentation with Sinon.JS v3.0.0+ practices,
replacing the deprecated three-argument stub syntax with the `callsFake()` method.
Copy link

netlify bot commented Oct 17, 2024

👷 Deploy request for cypress-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 87faf51

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399
Copy link
Contributor

@sadie100
Copy link
Author

I didn't see that! I'll close this.

@sadie100 sadie100 closed this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants