{
  "doc": {
    "id": "api/cypress-api/expose",
    "title": "Cypress.expose()",
    "description": "Read and write public configuration values in Cypress using Cypress.expose(). Learn syntax, examples, security considerations, and how it differs from cy.env().",
    "section": "api",
    "source_path": "/llm/markdown/api/cypress-api/expose.md",
    "version": "29f95bf8bb06f320986f3749f5bf09a35a409eab",
    "updated_at": "2026-09-04T10:49:54.630Z",
    "headings": [
      {
        "id": "api/cypress-api/expose#cypress-expose",
        "text": "Cypress.expose",
        "level": 1
      },
      {
        "id": "api/cypress-api/expose#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#get-all-exposed-configuration-variables",
        "text": "Get all exposed configuration variables",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#get-a-single-exposed-configuration-variable",
        "text": "Get a single exposed configuration variable",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#set-a-single-exposed-configuration-variable",
        "text": "Set a single exposed configuration variable",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#set-multiple-exposed-values",
        "text": "Set multiple exposed values",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#declare-expose-values-with-test-configuration",
        "text": "Declare expose values with test configuration",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#configuration-sources",
        "text": "Configuration sources",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#cypress-configuration-file",
        "text": "Cypress configuration file",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#cli-flags",
        "text": "CLI Flags",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#common-use-cases",
        "text": "Common use cases",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#use-cypress-expose-in-plugins-or-support-files",
        "text": "Use Cypress.expose() in plugins or support files",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#migrate-from-cypress-env-to-cypress-expose",
        "text": "Migrate from Cypress.env() to Cypress.expose()",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#when-to-use-cy-env-vs-cypress-expose",
        "text": "When to use cy.env() vs Cypress.expose()",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#use-cypress-expose-for-public-configuration",
        "text": "Use Cypress.expose() for public configuration",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#use-cy-env-for-sensitive-or-secret-values",
        "text": "Use cy.env() for sensitive or secret values",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#scope-and-lifecycle-limitations",
        "text": "Scope and lifecycle limitations",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/cypress-api/expose#syntax",
      "doc_id": "api/cypress-api/expose",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\nCypress.expose()\nCypress.expose(key)\nCypress.expose(key, value)\nCypress.expose(object)\n```\n\n### Arguments\n\n**key _(String)_**\n\nThe name of the exposed configuration variable to get or set.\n\n**value _(any)_**\n\nThe value of the exposed configuration variable to set. Can be any serializable type (string, number, boolean, object, etc.).\n\n**object _(Object)_**\n\nSet multiple exposed configuration variables with an object literal. Values are merged with existing values.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 83
    },
    {
      "id": "api/cypress-api/expose#arguments",
      "doc_id": "api/cypress-api/expose",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**key _(String)_**\n\nThe name of the exposed configuration variable to get or set.\n\n**value _(any)_**\n\nThe value of the exposed configuration variable to set. Can be any serializable type (string, number, boolean, object, etc.).\n\n**object _(Object)_**\n\nSet multiple exposed configuration variables with an object literal. Values are merged with existing values.\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 71
    },
    {
      "id": "api/cypress-api/expose#examples",
      "doc_id": "api/cypress-api/expose",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Get all exposed configuration variables\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'value1',\n    featureFlag: true,\n    apiVersion: 2,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'value1',\n    featureFlag: true,\n    apiVersion: 2,\n  },\n})\n```\n\n```\nCypress.expose() // => {pluginConfig: 'value1', featureFlag: true, apiVersion: 2}\n```\n\n### Get a single exposed configuration variable\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'my-plugin-config',\n    featureFlag: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'my-plugin-config',\n    featureFlag: true,\n  },\n})\n```\n\n```\nCypress.expose('pluginConfig') // => \"my-plugin-config\"\nCypress.expose('featureFlag') // => true\nCypress.expose('nonExistent') // => undefined\n```\n\n### Set a single exposed configuration variable\n\nChanges made with `Cypress.expose()` apply only for the remainder of the _current spec file_.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n  },\n})\n```\n\n```\nCypress.expose('pluginConfig', 'updated-value')\n\nCypress.expose('pluginConfig') // => \"updated-value\"\n```\n\n#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nCypress.expose({\n  pluginConfig: 'updated-value',\n  featureFlag: true,\n})\n\nCypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n\n### Declare expose values with test configuration\n\nYou can pass an `expose` object as part of suite- or test-level [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). This is useful when a plugin or preprocessor needs different public configuration values per suite or test.\n\nOverride keys are applied at test start and restored after each test completes. Suite- and test-level overrides are merged, with test-level keys taking precedence. Values set at runtime with `Cypress.expose()` outside of test configuration overrides are not automatically restored between tests.\n\n```\ndescribe('checkout', { expose: { flow: 'guest' } }, () => {\n  it('applies suite expose values', () => {\n    expect(Cypress.expose('flow')).to.eq('guest')\n  })\n\n  it(\n    'merges test-level expose values with suite values',\n    { expose: { step: 'payment' } },\n    () => {\n      expect(Cypress.expose('flow')).to.eq('guest')\n      expect(Cypress.expose('step')).to.eq('payment')\n    }\n  )\n})\n```\n\nWhen suite- and test-level expose define the same key, the test-level value takes precedence:\n\n```\ndescribe('orders', { expose: { status: 'pending' } }, () => {\n  it('uses the test-level value', { expose: { status: 'complete' } }, () => {\n    expect(Cypress.expose('status')).to.eq('complete')\n  })\n})\n```\n\nExpose overrides persist through hooks for the current test. Only keys declared in test configuration overrides are restored after each test:\n\n```\ndescribe('hook lifecycle', { expose: { source: 'suite' } }, () => {\n  beforeEach(() => {\n    Cypress.expose('source', 'beforeEach')\n  })\n\n  afterEach(() => {\n    expect(Cypress.expose('source')).to.eq('beforeEach')\n  })\n\n  it('sees hook mutations during the test body', () => {\n    expect(Cypress.expose('source')).to.eq('beforeEach')\n  })\n})\n```\n\nIf you mutate an overridden value during a test, the next test without an override for that key sees the pre-override value again:\n\n```\nit('applies the override', { expose: { token: 'override' } }, () => {\n  Cypress.expose('token', 'mutated')\n  expect(Cypress.expose('token')).to.eq('mutated')\n})\n\nit('restores the key after the override test completes', () => {\n  expect(Cypress.expose('token')).to.eq(undefined)\n})\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 719
    },
    {
      "id": "api/cypress-api/expose#get-all-exposed-configuration-variables",
      "doc_id": "api/cypress-api/expose",
      "heading": "Get all exposed configuration variables",
      "heading_level": 3,
      "content_markdown": "### Get all exposed configuration variables\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'value1',\n    featureFlag: true,\n    apiVersion: 2,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'value1',\n    featureFlag: true,\n    apiVersion: 2,\n  },\n})\n```\n\n```\nCypress.expose() // => {pluginConfig: 'value1', featureFlag: true, apiVersion: 2}\n```\n",
      "section": "api",
      "anchors": [
        "get-all-exposed-configuration-variables"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 84
    },
    {
      "id": "api/cypress-api/expose#get-a-single-exposed-configuration-variable",
      "doc_id": "api/cypress-api/expose",
      "heading": "Get a single exposed configuration variable",
      "heading_level": 3,
      "content_markdown": "### Get a single exposed configuration variable\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'my-plugin-config',\n    featureFlag: true,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'my-plugin-config',\n    featureFlag: true,\n  },\n})\n```\n\n```\nCypress.expose('pluginConfig') // => \"my-plugin-config\"\nCypress.expose('featureFlag') // => true\nCypress.expose('nonExistent') // => undefined\n```\n",
      "section": "api",
      "anchors": [
        "get-a-single-exposed-configuration-variable"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 84
    },
    {
      "id": "api/cypress-api/expose#set-a-single-exposed-configuration-variable",
      "doc_id": "api/cypress-api/expose",
      "heading": "Set a single exposed configuration variable",
      "heading_level": 3,
      "content_markdown": "### Set a single exposed configuration variable\n\nChanges made with `Cypress.expose()` apply only for the remainder of the _current spec file_.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n  },\n})\n```\n\n```\nCypress.expose('pluginConfig', 'updated-value')\n\nCypress.expose('pluginConfig') // => \"updated-value\"\n```\n\n#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nCypress.expose({\n  pluginConfig: 'updated-value',\n  featureFlag: true,\n})\n\nCypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n",
      "section": "api",
      "anchors": [
        "set-a-single-exposed-configuration-variable"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 172
    },
    {
      "id": "api/cypress-api/expose#set-multiple-exposed-values",
      "doc_id": "api/cypress-api/expose",
      "heading": "Set multiple exposed values",
      "heading_level": 4,
      "content_markdown": "#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'initial-value',\n    featureFlag: false,\n  },\n})\n```\n\n```\nCypress.expose({\n  pluginConfig: 'updated-value',\n  featureFlag: true,\n})\n\nCypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n",
      "section": "api",
      "anchors": [
        "set-multiple-exposed-values"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 83
    },
    {
      "id": "api/cypress-api/expose#declare-expose-values-with-test-configuration",
      "doc_id": "api/cypress-api/expose",
      "heading": "Declare expose values with test configuration",
      "heading_level": 3,
      "content_markdown": "### Declare expose values with test configuration\n\nYou can pass an `expose` object as part of suite- or test-level [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). This is useful when a plugin or preprocessor needs different public configuration values per suite or test.\n\nOverride keys are applied at test start and restored after each test completes. Suite- and test-level overrides are merged, with test-level keys taking precedence. Values set at runtime with `Cypress.expose()` outside of test configuration overrides are not automatically restored between tests.\n\n```\ndescribe('checkout', { expose: { flow: 'guest' } }, () => {\n  it('applies suite expose values', () => {\n    expect(Cypress.expose('flow')).to.eq('guest')\n  })\n\n  it(\n    'merges test-level expose values with suite values',\n    { expose: { step: 'payment' } },\n    () => {\n      expect(Cypress.expose('flow')).to.eq('guest')\n      expect(Cypress.expose('step')).to.eq('payment')\n    }\n  )\n})\n```\n\nWhen suite- and test-level expose define the same key, the test-level value takes precedence:\n\n```\ndescribe('orders', { expose: { status: 'pending' } }, () => {\n  it('uses the test-level value', { expose: { status: 'complete' } }, () => {\n    expect(Cypress.expose('status')).to.eq('complete')\n  })\n})\n```\n\nExpose overrides persist through hooks for the current test. Only keys declared in test configuration overrides are restored after each test:\n\n```\ndescribe('hook lifecycle', { expose: { source: 'suite' } }, () => {\n  beforeEach(() => {\n    Cypress.expose('source', 'beforeEach')\n  })\n\n  afterEach(() => {\n    expect(Cypress.expose('source')).to.eq('beforeEach')\n  })\n\n  it('sees hook mutations during the test body', () => {\n    expect(Cypress.expose('source')).to.eq('beforeEach')\n  })\n})\n```\n\nIf you mutate an overridden value during a test, the next test without an override for that key sees the pre-override value again:\n\n```\nit('applies the override', { expose: { token: 'override' } }, () => {\n  Cypress.expose('token', 'mutated')\n  expect(Cypress.expose('token')).to.eq('mutated')\n})\n\nit('restores the key after the override test completes', () => {\n  expect(Cypress.expose('token')).to.eq(undefined)\n})\n```\n",
      "section": "api",
      "anchors": [
        "declare-expose-values-with-test-configuration"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 376
    },
    {
      "id": "api/cypress-api/expose#configuration-sources",
      "doc_id": "api/cypress-api/expose",
      "heading": "Configuration sources",
      "heading_level": 2,
      "content_markdown": "## Configuration sources\n\nRead the [Environment Variables & Secrets](/llm/markdown/app/guides/environment-variables.md) guide for more details.\n\n### Cypress configuration file\n\nExposed configuration variables can be set in your [Cypress configuration](/llm/markdown/app/references/configuration.md) file:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'foo',\n    featureFlag: true,\n    apiVersion: 1,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'foo',\n    featureFlag: true,\n    apiVersion: 1,\n  },\n})\n```\n\n```\n// In your test or support file\nconst pluginConfig = Cypress.expose('pluginConfig') // => \"foo\"\nconst featureFlag = Cypress.expose('featureFlag') // => true\nconst apiVersion = Cypress.expose('API_VERSION') // => 1\n```\n\n### CLI Flags\n\nYou can set exposed configuration variables using the `--expose` or `-x` CLI flags. CLI values override configuration file values.\n\n```\ncypress run --expose pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n\nOr using the short form:\n\n```\ncypress run -x pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n",
      "section": "api",
      "anchors": [
        "configuration-sources"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 191
    },
    {
      "id": "api/cypress-api/expose#cypress-configuration-file",
      "doc_id": "api/cypress-api/expose",
      "heading": "Cypress configuration file",
      "heading_level": 3,
      "content_markdown": "### Cypress configuration file\n\nExposed configuration variables can be set in your [Cypress configuration](/llm/markdown/app/references/configuration.md) file:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  expose: {\n    pluginConfig: 'foo',\n    featureFlag: true,\n    apiVersion: 1,\n  },\n})\n```\n\n```\nimport { defineConfig } from 'cypress'\n\nexport default defineConfig({\n  expose: {\n    pluginConfig: 'foo',\n    featureFlag: true,\n    apiVersion: 1,\n  },\n})\n```\n\n```\n// In your test or support file\nconst pluginConfig = Cypress.expose('pluginConfig') // => \"foo\"\nconst featureFlag = Cypress.expose('featureFlag') // => true\nconst apiVersion = Cypress.expose('API_VERSION') // => 1\n```\n",
      "section": "api",
      "anchors": [
        "cypress-configuration-file"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 121
    },
    {
      "id": "api/cypress-api/expose#cli-flags",
      "doc_id": "api/cypress-api/expose",
      "heading": "CLI Flags",
      "heading_level": 3,
      "content_markdown": "### CLI Flags\n\nYou can set exposed configuration variables using the `--expose` or `-x` CLI flags. CLI values override configuration file values.\n\n```\ncypress run --expose pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n\nOr using the short form:\n\n```\ncypress run -x pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n",
      "section": "api",
      "anchors": [
        "cli-flags"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 52
    },
    {
      "id": "api/cypress-api/expose#common-use-cases",
      "doc_id": "api/cypress-api/expose",
      "heading": "Common use cases",
      "heading_level": 2,
      "content_markdown": "## Common use cases\n\n### Use Cypress.expose() in plugins or support files\n\n`Cypress.expose()` is ideal when configuration is needed outside of Cypress command chains:\n\n```\n// cypress/support/commands.js or plugin code\nconst pluginConfig = Cypress.expose('pluginConfig')\n\nif (pluginConfig === 'enabled') {\n  initializePlugin(pluginConfig)\n}\n```\n",
      "section": "api",
      "anchors": [
        "common-use-cases"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 56
    },
    {
      "id": "api/cypress-api/expose#use-cypress-expose-in-plugins-or-support-files",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use Cypress.expose() in plugins or support files",
      "heading_level": 3,
      "content_markdown": "### Use Cypress.expose() in plugins or support files\n\n`Cypress.expose()` is ideal when configuration is needed outside of Cypress command chains:\n\n```\n// cypress/support/commands.js or plugin code\nconst pluginConfig = Cypress.expose('pluginConfig')\n\nif (pluginConfig === 'enabled') {\n  initializePlugin(pluginConfig)\n}\n```\n",
      "section": "api",
      "anchors": [
        "use-cypress-expose-in-plugins-or-support-files"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 51
    },
    {
      "id": "api/cypress-api/expose#migrate-from-cypress-env-to-cypress-expose",
      "doc_id": "api/cypress-api/expose",
      "heading": "Migrate from Cypress.env() to Cypress.expose()",
      "heading_level": 2,
      "content_markdown": "## Migrate from Cypress.env() to Cypress.expose()\n\nIf you're migrating a plugin from `Cypress.env()` to `Cypress.expose()`, the API is similar:\n\n**Before (using `Cypress.env()`, removed in Cypress 16.0):**\n\n```\nconst config = Cypress.env('PLUGIN_CONFIG')\n```\n\n**After (using `Cypress.expose()`):**\n\n```\nconst config = Cypress.expose('PLUGIN_CONFIG')\n```\n\nUpdate your configuration file:\n\n**Before:**\n\n```\n{\n  env: {\n    PLUGIN_CONFIG: 'value',\n  },\n}\n```\n\n**After:**\n\n```\n{\n  expose: {\n    PLUGIN_CONFIG: 'value',\n  },\n}\n```\n",
      "section": "api",
      "anchors": [
        "migrate-from-cypress-env-to-cypress-expose"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 87
    },
    {
      "id": "api/cypress-api/expose#notes",
      "doc_id": "api/cypress-api/expose",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### When to use `cy.env()` vs `Cypress.expose()`\n\nBoth [`cy.env()`](/llm/markdown/api/commands/env.md) and [`Cypress.expose()`](/llm/markdown/api/cypress-api/expose.md) provide access to configuration values in Cypress, but they serve different security and execution needs. Choosing the right API helps avoid accidental exposure of sensitive data and keeps configuration intent clear.\n\n#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n\n#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive values\ncy.env(['apiKey']).then(({ apiKey }) => {\n  cy.request({\n    url: 'https://api.example.com/users',\n    headers: { Authorization: `Bearer ${apiKey}` },\n  })\n})\n\n// ✅ Use Cypress.expose() for public configuration\nconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public value\nconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n\n### Scope and lifecycle limitations\n\n*   Exposed values persist only while the browser is open.\n*   Runtime changes apply only within the current spec file\n*   Values do not propagate back to Node.js contexts such as `setupNodeEvents`\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 365
    },
    {
      "id": "api/cypress-api/expose#when-to-use-cy-env-vs-cypress-expose",
      "doc_id": "api/cypress-api/expose",
      "heading": "When to use cy.env() vs Cypress.expose()",
      "heading_level": 3,
      "content_markdown": "### When to use `cy.env()` vs `Cypress.expose()`\n\nBoth [`cy.env()`](/llm/markdown/api/commands/env.md) and [`Cypress.expose()`](/llm/markdown/api/cypress-api/expose.md) provide access to configuration values in Cypress, but they serve different security and execution needs. Choosing the right API helps avoid accidental exposure of sensitive data and keeps configuration intent clear.\n\n#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n\n#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive values\ncy.env(['apiKey']).then(({ apiKey }) => {\n  cy.request({\n    url: 'https://api.example.com/users',\n    headers: { Authorization: `Bearer ${apiKey}` },\n  })\n})\n\n// ✅ Use Cypress.expose() for public configuration\nconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public value\nconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n",
      "section": "api",
      "anchors": [
        "when-to-use-cy-env-vs-cypress-expose"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 313
    },
    {
      "id": "api/cypress-api/expose#use-cypress-expose-for-public-configuration",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use Cypress.expose() for public configuration",
      "heading_level": 4,
      "content_markdown": "#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n",
      "section": "api",
      "anchors": [
        "use-cypress-expose-for-public-configuration"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 65
    },
    {
      "id": "api/cypress-api/expose#use-cy-env-for-sensitive-or-secret-values",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use cy.env() for sensitive or secret values",
      "heading_level": 4,
      "content_markdown": "#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive values\ncy.env(['apiKey']).then(({ apiKey }) => {\n  cy.request({\n    url: 'https://api.example.com/users',\n    headers: { Authorization: `Bearer ${apiKey}` },\n  })\n})\n\n// ✅ Use Cypress.expose() for public configuration\nconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public value\nconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n",
      "section": "api",
      "anchors": [
        "use-cy-env-for-sensitive-or-secret-values"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 192
    },
    {
      "id": "api/cypress-api/expose#scope-and-lifecycle-limitations",
      "doc_id": "api/cypress-api/expose",
      "heading": "Scope and lifecycle limitations",
      "heading_level": 3,
      "content_markdown": "### Scope and lifecycle limitations\n\n*   Exposed values persist only while the browser is open.\n*   Runtime changes apply only within the current spec file\n*   Values do not propagate back to Node.js contexts such as `setupNodeEvents`\n",
      "section": "api",
      "anchors": [
        "scope-and-lifecycle-limitations"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 49
    },
    {
      "id": "api/cypress-api/expose#history",
      "doc_id": "api/cypress-api/expose",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [15.17.0](/llm/markdown/app/references/changelog.md#15-17-0) | Added test configuration overrides for `Cypress.expose()` values. |\n| [15.10.0](/llm/markdown/app/references/changelog.md#15-10-0) | `Cypress.expose()` API introduced |\n",
      "section": "api",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 40
    }
  ]
}