{
  "doc": {
    "id": "app/references/bundled-libraries",
    "title": "Bundled Libraries in Cypress",
    "description": "Cypress bundles Mocha, Chai, Chai-jQuery, Sinon, Sinon-Chai, Lodash, jQuery, and more, so you can write tests immediately with no extra installation or configuration.",
    "section": "app",
    "source_path": "/llm/markdown/app/references/bundled-libraries.md",
    "version": "e6c8d867c21227247f14714fb5690c7c018983c5",
    "updated_at": "2026-08-08T12:39:37.868Z",
    "headings": [
      {
        "id": "app/references/bundled-libraries#bundled-libraries",
        "text": "Bundled Libraries",
        "level": 1
      },
      {
        "id": "app/references/bundled-libraries#whats-included",
        "text": "What's included",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#mocha",
        "text": "Mocha",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#chai",
        "text": "Chai",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#chai-jquery",
        "text": "Chai-jQuery",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#sinon",
        "text": "Sinon",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#sinon-chai",
        "text": "Sinon-Chai",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#utility-libraries",
        "text": "Utility libraries",
        "level": 2
      },
      {
        "id": "app/references/bundled-libraries#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "Bundled Libraries"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress ships with a set of proven open source testing libraries built in: "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://mochajs.org/",
            "children": [
              {
                "type": "text",
                "value": "Mocha"
              }
            ]
          },
          {
            "type": "text",
            "value": " structures your tests, "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://www.chaijs.com/",
            "children": [
              {
                "type": "text",
                "value": "Chai"
              }
            ]
          },
          {
            "type": "text",
            "value": " powers your assertions, and "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://sinonjs.org/",
            "children": [
              {
                "type": "text",
                "value": "Sinon"
              }
            ]
          },
          {
            "type": "text",
            "value": " provides spies and stubs, alongside utility libraries like "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://lodash.com/",
            "children": [
              {
                "type": "text",
                "value": "Lodash"
              }
            ]
          },
          {
            "type": "text",
            "value": " and "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://jquery.com/",
            "children": [
              {
                "type": "text",
                "value": "jQuery"
              }
            ]
          },
          {
            "type": "text",
            "value": ". You don't install, import, or configure any of them. They're bundled inside Cypress and ready to use in every test."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "If you've written JavaScript tests before, these tools will feel familiar, and what you already know about them carries over directly to Cypress."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "What's included"
          }
        ]
      },
      {
        "type": "table",
        "align": [
          null,
          null,
          null
        ],
        "children": [
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Library"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "What it does"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "How you use it in Cypress"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Mocha",
                    "children": [
                      {
                        "type": "text",
                        "value": "Mocha"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Test framework and runner syntax"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`describe()`, `it()`, `beforeEach()`, and other hooks"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Chai",
                    "children": [
                      {
                        "type": "text",
                        "value": "Chai"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Assertion library"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "`expect()`, `assert()`, and "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/should.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.should()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Chai-jQuery",
                    "children": [
                      {
                        "type": "text",
                        "value": "Chai-jQuery"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "DOM-specific assertions"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Chainers like `have.class` and `be.visible` on DOM subjects"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Sinon",
                    "children": [
                      {
                        "type": "text",
                        "value": "Sinon"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Spies, stubs, and fake timers"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/spy.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.spy()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/stub.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.stub()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/clock.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.clock()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/sinon.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.sinon`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Sinon-Chai",
                    "children": [
                      {
                        "type": "text",
                        "value": "Sinon-Chai"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Assertions on spies and stubs"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Chainers like `have.been.calledOnce`"
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "Lodash"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "General-purpose utility functions"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/_.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress._`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "jQuery"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "DOM traversal and manipulation"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/$.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.$`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "minimatch"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Glob pattern matching"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/minimatch.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.minimatch`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "blob-util"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Blob and base64 conversion"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/blob.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Blob`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "Buffer"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Binary data handling in the browser"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/buffer.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Buffer`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "tableRow",
            "children": [
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "#Utility-libraries",
                    "children": [
                      {
                        "type": "text",
                        "value": "Bluebird"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "text",
                    "value": "Promise library"
                  }
                ]
              },
              {
                "type": "tableCell",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/promise.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Promise`"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress always uses its own bundled versions of these libraries. Installing a different version of Mocha, Chai, or Sinon in your project won't change the version Cypress runs, and no version needs to be installed for Cypress to work."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "If you write your tests in TypeScript, note that Cypress also ships type definitions for these bundled globals. Projects that install `@types/chai` or `@types/jquery`, or that run Jest alongside Cypress, can end up with clashing global types. See "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/tooling/typescript-support.md#Configure-tsconfigjson",
            "children": [
              {
                "type": "text",
                "value": "Configure tsconfig.json"
              }
            ]
          },
          {
            "type": "text",
            "value": " and "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/tooling/typescript-support.md#Clashing-types-with-Jest",
            "children": [
              {
                "type": "text",
                "value": "Clashing types with Jest"
              }
            ]
          },
          {
            "type": "text",
            "value": " for the recommended setup."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Mocha"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress uses "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://mochajs.org/",
            "children": [
              {
                "type": "text",
                "value": "Mocha"
              }
            ]
          },
          {
            "type": "text",
            "value": "'s `bdd` interface to structure and run your tests. Every test you write, whether end-to-end or component, sits on the harness Mocha provides:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#bdd",
                    "children": [
                      {
                        "type": "text",
                        "value": "`describe()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#bdd",
                    "children": [
                      {
                        "type": "text",
                        "value": "`context()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#bdd",
                    "children": [
                      {
                        "type": "text",
                        "value": "`it()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#hooks",
                    "children": [
                      {
                        "type": "text",
                        "value": "`before()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#hooks",
                    "children": [
                      {
                        "type": "text",
                        "value": "`beforeEach()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#hooks",
                    "children": [
                      {
                        "type": "text",
                        "value": "`afterEach()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#hooks",
                    "children": [
                      {
                        "type": "text",
                        "value": "`after()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#exclusive-tests",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.only()`"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://mochajs.org/#inclusive-tests",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.skip()`"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "describe('Checkout', () => {  beforeEach(() => {    cy.visit('/cart')  })  it('completes an order', () => {    // test body  })})"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress extends Mocha under the hood, smoothing over edge cases and improving error messages. These changes are transparent: you write standard Mocha syntax, and Cypress handles the rest."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Read our guide on "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/writing-and-organizing-tests.md",
            "children": [
              {
                "type": "text",
                "value": "writing and organizing tests"
              }
            ]
          },
          {
            "type": "text",
            "value": " for how to structure specs with Mocha's syntax."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Chai"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "While Mocha structures your tests, "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://www.chaijs.com/",
            "children": [
              {
                "type": "text",
                "value": "Chai"
              }
            ]
          },
          {
            "type": "text",
            "value": " gives you readable assertions with clear error messages. Every assertion in Cypress is built on Chai, and you can use it two ways:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Implicitly, by chaining "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/should.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.should()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " or "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/and.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`.and()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " off a Cypress command. Cypress applies the Chai assertion to the command's "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions",
                    "children": [
                      {
                        "type": "text",
                        "value": "subject"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " and retries it until it passes or times out."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "Explicitly, with the globally available `expect` and `assert` functions."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// implicit, retried automaticallycy.get('[data-testid=\"greeting\"]').should('contain', 'Jane')// explicitexpect(user.name).to.equal('Jane')"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "The bundled Chai is also extensible. Install any Chai plugin, register it with `chai.use()` in your "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#Support-file",
            "children": [
              {
                "type": "text",
                "value": "support file"
              }
            ]
          },
          {
            "type": "text",
            "value": ", and its assertions work in both `expect()` and `.should()`. See "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/assertions.md#Adding-New-Assertions",
            "children": [
              {
                "type": "text",
                "value": "Adding New Assertions"
              }
            ]
          },
          {
            "type": "text",
            "value": " for details."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "See the full "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/assertions.md#Chai",
            "children": [
              {
                "type": "text",
                "value": "list of available Chai assertions"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Chai-jQuery"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Most end-to-end assertions are about the DOM. Cypress bundles "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://github.com/chaijs/chai-jquery",
            "children": [
              {
                "type": "text",
                "value": "Chai-jQuery"
              }
            ]
          },
          {
            "type": "text",
            "value": ", which extends Chai with jQuery-specific chainers, so you can assert directly on the elements your commands yield:"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy.get('[data-testid=\"submit\"]').should('have.class', 'active')cy.get('[data-testid=\"modal\"]').should('be.visible')"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "See the full "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/assertions.md#Chai-jQuery",
            "children": [
              {
                "type": "text",
                "value": "list of available Chai-jQuery assertions"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Sinon"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "When you need to verify or control how functions behave, Cypress provides "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://sinonjs.org/",
            "children": [
              {
                "type": "text",
                "value": "Sinon"
              }
            ]
          },
          {
            "type": "text",
            "value": "'s test doubles through built-in commands:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/spy.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.spy()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " wraps a function to record its calls without changing its behavior."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/stub.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.stub()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " replaces a function and controls its behavior."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/clock.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.clock()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " and "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/tick.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.tick()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " control time in your application using Sinon's fake timers."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress also exposes the full library as "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/api/utilities/sinon.md",
            "children": [
              {
                "type": "text",
                "value": "`Cypress.sinon`"
              }
            ]
          },
          {
            "type": "text",
            "value": ", so Sinon's matchers and other APIs are available anywhere in your tests."
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Read our guide on "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/guides/stubs-spies-and-clocks.md",
            "children": [
              {
                "type": "text",
                "value": "stubs, spies, and clocks"
              }
            ]
          },
          {
            "type": "text",
            "value": " for patterns and examples."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Sinon-Chai"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "To assert on spies and stubs with the same `.should()` syntax you use everywhere else, Cypress bundles "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://github.com/cypress-io/sinon-chai",
            "children": [
              {
                "type": "text",
                "value": "Sinon-Chai"
              }
            ]
          },
          {
            "type": "text",
            "value": ", which extends Chai with Sinon-specific chainers:"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "const stub = cy.stub().as('alert')cy.on('window:alert', stub)cy.get('[data-testid=\"delete\"]').click()cy.get('@alert').should('have.been.calledOnce')"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "See the full "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/app/references/assertions.md#Sinon-Chai",
            "children": [
              {
                "type": "text",
                "value": "list of available Sinon-Chai assertions"
              }
            ]
          },
          {
            "type": "text",
            "value": "."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Utility libraries"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress also bundles these libraries on the `Cypress` object. They're available anywhere in your tests, with no imports required:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/_.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress._`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://lodash.com/",
                    "children": [
                      {
                        "type": "text",
                        "value": "Lodash"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", for working with arrays, objects, and data transformations."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/$.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.$`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://jquery.com/",
                    "children": [
                      {
                        "type": "text",
                        "value": "jQuery"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", for DOM traversal outside of Cypress commands. DOM commands like "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/commands/get.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`cy.get()`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " also yield jQuery objects."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/minimatch.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.minimatch`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://github.com/isaacs/minimatch",
                    "children": [
                      {
                        "type": "text",
                        "value": "minimatch"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", for testing glob patterns against URLs or paths."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/blob.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Blob`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://github.com/nolanlawson/blob-util",
                    "children": [
                      {
                        "type": "text",
                        "value": "blob-util"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", for converting between blobs, base64 strings, and other binary formats."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/buffer.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Buffer`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": a "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://github.com/feross/buffer",
                    "children": [
                      {
                        "type": "text",
                        "value": "Buffer polyfill"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": " for working with binary data in the browser, such as file uploads."
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/api/utilities/promise.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "`Cypress.Promise`"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": "
                  },
                  {
                    "type": "link",
                    "title": null,
                    "url": "https://github.com/petkaantonov/bluebird",
                    "children": [
                      {
                        "type": "text",
                        "value": "Bluebird"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ", for creating and managing promises inside your tests."
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "See also"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/assertions.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Assertions reference"
                      }
                    ]
                  },
                  {
                    "type": "text",
                    "value": ": every Chai, Chai-jQuery, and Sinon-Chai assertion available in Cypress"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/introduction-to-cypress.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Introduction to Cypress"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/core-concepts/writing-and-organizing-tests.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Writing and Organizing Tests"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/guides/stubs-spies-and-clocks.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Stubs, Spies, and Clocks"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/troubleshooting.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Troubleshooting"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "token_estimate": 1135
}