{
  "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": "f60251bf707b0077a9535579c9f90d615440cc35",
    "updated_at": "2026-10-16T10:56:58.670Z",
    "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) => {\n  document.documentElement.style.setProperty(\n    '--background-color',\n    e.target.value\n  )\n})\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()\n  .its('documentElement.style')\n  .then((style) => {\n    cy.spy(style, 'setProperty').as('setColor')\n  })\n\ncy.get('input[type=color]').invoke('val', '#ff0000').trigger('change')\n\n// we don't care about '--background-color' exact\n// value but know it should be a string\ncy.get('@setColor').should(\n  'have.been.calledWith',\n  Cypress.sinon.match.string,\n  '#ff0000'\n)\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/utilities/sinon.json",
      "token_estimate": 144
    },
    {
      "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) => {\n  document.documentElement.style.setProperty(\n    '--background-color',\n    e.target.value\n  )\n})\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()\n  .its('documentElement.style')\n  .then((style) => {\n    cy.spy(style, 'setProperty').as('setColor')\n  })\n\ncy.get('input[type=color]').invoke('val', '#ff0000').trigger('change')\n\n// we don't care about '--background-color' exact\n// value but know it should be a string\ncy.get('@setColor').should(\n  'have.been.calledWith',\n  Cypress.sinon.match.string,\n  '#ff0000'\n)\n```\n",
      "section": "api",
      "anchors": [
        "match-string"
      ],
      "path": "/llm/json/chunked/api/utilities/sinon.json",
      "token_estimate": 141
    }
  ]
}