{
  "doc": {
    "id": "api/utilities/sinon",
    "title": "Cypress.sinon",
    "description": "Cypress automatically includes Sinon.JS and exposes it as Cypress.sinon.",
    "section": "api",
    "source_path": "/llm/markdown/api/utilities/sinon.md",
    "version": "24a73f8a97175663aaffd3b016289fb2a523a4ea",
    "updated_at": "2026-05-14T20:17:33.301Z",
    "headings": [
      {
        "id": "api/utilities/sinon#cypress-sinon",
        "text": "Cypress.sinon",
        "level": 1
      },
      {
        "id": "api/utilities/sinon#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/utilities/sinon#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/utilities/sinon#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/utilities/sinon#match-string",
        "text": "match.string",
        "level": 3
      },
      {
        "id": "api/utilities/sinon#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/utilities/sinon#examples",
      "doc_id": "api/utilities/sinon",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### `match.string`\n\nThis example comes from the recipe [Root style](https://github.com/cypress-io/cypress-example-recipes#testing-the-dom). Imagine an application code where the method `setProperty` is called to change a CSS variable:\n\n```\ndocument.querySelector('input[type=color]').addEventListener('change', (e) => {  document.documentElement.style.setProperty(    '--background-color',    e.target.value  )})\n```\n\nWe can write a test to confirm that the method `setProperty` was called with two strings; we don't care about value of the first string, but we do want to check if it was indeed a string.\n\n```\ncy.document()  .its('documentElement.style')  .then((style) => {    cy.spy(style, 'setProperty').as('setColor')  })cy.get('input[type=color]').invoke('val', '#ff0000').trigger('change')// we don't care about '--background-color' exact// value but know it should be a stringcy.get('@setColor').should(  'have.been.calledWith',  Cypress.sinon.match.string,  '#ff0000')\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/utilities/sinon.json",
      "token_estimate": 136
    },
    {
      "id": "api/utilities/sinon#match-string",
      "doc_id": "api/utilities/sinon",
      "heading": "match.string",
      "heading_level": 3,
      "content_markdown": "### `match.string`\n\nThis example comes from the recipe [Root style](https://github.com/cypress-io/cypress-example-recipes#testing-the-dom). Imagine an application code where the method `setProperty` is called to change a CSS variable:\n\n```\ndocument.querySelector('input[type=color]').addEventListener('change', (e) => {  document.documentElement.style.setProperty(    '--background-color',    e.target.value  )})\n```\n\nWe can write a test to confirm that the method `setProperty` was called with two strings; we don't care about value of the first string, but we do want to check if it was indeed a string.\n\n```\ncy.document()  .its('documentElement.style')  .then((style) => {    cy.spy(style, 'setProperty').as('setColor')  })cy.get('input[type=color]').invoke('val', '#ff0000').trigger('change')// we don't care about '--background-color' exact// value but know it should be a stringcy.get('@setColor').should(  'have.been.calledWith',  Cypress.sinon.match.string,  '#ff0000')\n```\n",
      "section": "api",
      "anchors": [
        "match-string"
      ],
      "path": "/llm/json/chunked/api/utilities/sinon.json",
      "token_estimate": 133
    }
  ]
}