{
  "doc": {
    "id": "api/cypress-api/config",
    "title": "Cypress.config | Cypress Documentation",
    "description": "Get and set configuration options in your tests.",
    "section": "api",
    "source_path": "/llm/markdown/api/cypress-api/config.md",
    "version": "48b03b5502f7aea1d0454750cce208f775403542",
    "updated_at": "2026-05-20T19:00:20.270Z",
    "headings": [
      {
        "id": "api/cypress-api/config#cypress-config",
        "text": "Cypress.config",
        "level": 1
      },
      {
        "id": "api/cypress-api/config#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/cypress-api/config#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/cypress-api/config#no-arguments",
        "text": "No Arguments",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#get-all-configuration-options-from-the-cypress-configuration",
        "text": "Get all configuration options from the Cypress configuration",
        "level": 4
      },
      {
        "id": "api/cypress-api/config#name",
        "text": "Name",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#return-a-single-configuration-option-from-the-cypress-configuration",
        "text": "Return a single configuration option from the Cypress configuration",
        "level": 4
      },
      {
        "id": "api/cypress-api/config#name-and-value",
        "text": "Name and Value",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#change-the-values-of-configuration-options-from-the-cypress-configuration-from-within-your-tests",
        "text": "Change the values of configuration options from the Cypress configuration from within your tests",
        "level": 4
      },
      {
        "id": "api/cypress-api/config#object",
        "text": "Object",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#override-multiple-options-from-the-cypress-configuration-by-passing-an-object",
        "text": "Override multiple options from the Cypress configuration by passing an object",
        "level": 4
      },
      {
        "id": "api/cypress-api/config#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/cypress-api/config#not-all-config-values-can-be-changed-at-all-times",
        "text": "Not all config values can be changed at all times",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#test-configuration-vs-cypress-config",
        "text": "Test Configuration vs Cypress.config()",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#cypress-config-executes-synchronously",
        "text": "Cypress.config() executes Synchronously",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#why-is-it-cypress-config-and-not-cy-config",
        "text": "Why is it Cypress.config and not cy.config?",
        "level": 3
      },
      {
        "id": "api/cypress-api/config#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/cypress-api/config#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/cypress-api/config#syntax",
      "doc_id": "api/cypress-api/config",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\nCypress.config()Cypress.config(name)Cypress.config(name, value)Cypress.config(object)\n```\n\n### Arguments\n\n**name _(String)_**\n\nThe name of the configuration to get or set.\n\n**value _(Any)_**\n\nThe value of the configuration to set.\n\n**object _(Object)_**\n\nSet multiple configuration options with an object literal.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 51
    },
    {
      "id": "api/cypress-api/config#arguments",
      "doc_id": "api/cypress-api/config",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**name _(String)_**\n\nThe name of the configuration to get or set.\n\n**value _(Any)_**\n\nThe value of the configuration to set.\n\n**object _(Object)_**\n\nSet multiple configuration options with an object literal.\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 43
    },
    {
      "id": "api/cypress-api/config#examples",
      "doc_id": "api/cypress-api/config",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### No Arguments\n\n#### Get all configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nCypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}\n```\n\n### Name\n\n#### Return a single configuration option from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nCypress.config('pageLoadTimeout') // => 60000\n```\n\n### Name and Value\n\n#### Change the values of configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) from within your tests\n\n**Scope**\n\nRemember, any changes that you make to configuration using this API will be in effect for the remainder of the tests _in the same spec file._\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nCypress.config('viewportWidth', 800)Cypress.config('viewportWidth') // => 800\n```\n\n### Object\n\n#### Override multiple options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) by passing an object\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nCypress.config({  defaultCommandTimeout: 10000,  viewportHeight: 900,})Cypress.config() // => {defaultCommandTimeout: 10000, viewportHeight: 900, ...}\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 324
    },
    {
      "id": "api/cypress-api/config#no-arguments",
      "doc_id": "api/cypress-api/config",
      "heading": "No Arguments",
      "heading_level": 3,
      "content_markdown": "### No Arguments\n\n#### Get all configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nCypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}\n```\n",
      "section": "api",
      "anchors": [
        "no-arguments"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 67
    },
    {
      "id": "api/cypress-api/config#get-all-configuration-options-from-the-cypress-configuration",
      "doc_id": "api/cypress-api/config",
      "heading": "Get all configuration options from the Cypress configuration",
      "heading_level": 4,
      "content_markdown": "#### Get all configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 10000,})\n```\n\n```\nCypress.config() // => {defaultCommandTimeout: 10000, pageLoadTimeout: 30000, ...}\n```\n",
      "section": "api",
      "anchors": [
        "get-all-configuration-options-from-the-cypress-configuration"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 63
    },
    {
      "id": "api/cypress-api/config#name",
      "doc_id": "api/cypress-api/config",
      "heading": "Name",
      "heading_level": 3,
      "content_markdown": "### Name\n\n#### Return a single configuration option from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nCypress.config('pageLoadTimeout') // => 60000\n```\n",
      "section": "api",
      "anchors": [
        "name"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 61
    },
    {
      "id": "api/cypress-api/config#return-a-single-configuration-option-from-the-cypress-configuration",
      "doc_id": "api/cypress-api/config",
      "heading": "Return a single configuration option from the Cypress configuration",
      "heading_level": 4,
      "content_markdown": "#### Return a single configuration option from the [Cypress configuration](/llm/markdown/app/references/configuration.md)\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  pageLoadTimeout: 60000,})\n```\n\n```\nCypress.config('pageLoadTimeout') // => 60000\n```\n",
      "section": "api",
      "anchors": [
        "return-a-single-configuration-option-from-the-cypress-configuration"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 59
    },
    {
      "id": "api/cypress-api/config#name-and-value",
      "doc_id": "api/cypress-api/config",
      "heading": "Name and Value",
      "heading_level": 3,
      "content_markdown": "### Name and Value\n\n#### Change the values of configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) from within your tests\n\n**Scope**\n\nRemember, any changes that you make to configuration using this API will be in effect for the remainder of the tests _in the same spec file._\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nCypress.config('viewportWidth', 800)Cypress.config('viewportWidth') // => 800\n```\n",
      "section": "api",
      "anchors": [
        "name-and-value"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 113
    },
    {
      "id": "api/cypress-api/config#change-the-values-of-configuration-options-from-the-cypress-configuration-from-within-your-tests",
      "doc_id": "api/cypress-api/config",
      "heading": "Change the values of configuration options from the Cypress configuration from within your tests",
      "heading_level": 4,
      "content_markdown": "#### Change the values of configuration options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) from within your tests\n\n**Scope**\n\nRemember, any changes that you make to configuration using this API will be in effect for the remainder of the tests _in the same spec file._\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  viewportWidth: 1280,  viewportHeight: 720,})\n```\n\n```\nCypress.config('viewportWidth', 800)Cypress.config('viewportWidth') // => 800\n```\n",
      "section": "api",
      "anchors": [
        "change-the-values-of-configuration-options-from-the-cypress-configuration-from-within-your-tests"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 108
    },
    {
      "id": "api/cypress-api/config#object",
      "doc_id": "api/cypress-api/config",
      "heading": "Object",
      "heading_level": 3,
      "content_markdown": "### Object\n\n#### Override multiple options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) by passing an object\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nCypress.config({  defaultCommandTimeout: 10000,  viewportHeight: 900,})Cypress.config() // => {defaultCommandTimeout: 10000, viewportHeight: 900, ...}\n```\n",
      "section": "api",
      "anchors": [
        "object"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 80
    },
    {
      "id": "api/cypress-api/config#override-multiple-options-from-the-cypress-configuration-by-passing-an-object",
      "doc_id": "api/cypress-api/config",
      "heading": "Override multiple options from the Cypress configuration by passing an object",
      "heading_level": 4,
      "content_markdown": "#### Override multiple options from the [Cypress configuration](/llm/markdown/app/references/configuration.md) by passing an object\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  defaultCommandTimeout: 4000,  pageLoadTimeout: 30000,})\n```\n\n```\nCypress.config({  defaultCommandTimeout: 10000,  viewportHeight: 900,})Cypress.config() // => {defaultCommandTimeout: 10000, viewportHeight: 900, ...}\n```\n",
      "section": "api",
      "anchors": [
        "override-multiple-options-from-the-cypress-configuration-by-passing-an-object"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 77
    },
    {
      "id": "api/cypress-api/config#notes",
      "doc_id": "api/cypress-api/config",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Not all config values can be changed at all times\n\nSome configuration values are readonly and cannot be changed while running a test. Anything that's not directly under Cypress's control - like timeouts or environment variables - will be ignored at run-time. Be sure to review the list of [test configuration options](/llm/markdown/app/references/configuration.md#Test-Configuration).\n\n### Test Configuration vs `Cypress.config()`\n\nTo apply specific Cypress configuration values to a suite or test, you can pass a [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration) object to the test or suite function.\n\nWhile `Cypress.config()` changes configuration values through the entire spec file, using test configuration will only change configuration values during the suite or test where they are set. The values will then reset to the previous default values after the suite or test is complete.\n\nSee the full guide on [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration).\n\n### `Cypress.config()` executes Synchronously\n\nIt's important to note that `Cypress.config()` executes synchronously and will not wait for the Cypress commands above it to execute. If you need to update your configuration mid-test, be sure to chain the [asynchronously Cypress command](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Are-Asynchronous).\n\n```\nit('using cy.then', () => {  cy.visit('/my-test_page')  cy.click('#download-html').then(() => {    Cypress.config('baseUrl', null)  })  cy.visit('/downloads/contents.html')})\n```\n\n### Why is it `Cypress.config` and not `cy.config`?\n\nAs a rule of thumb anything you call from `Cypress` affects global state. Anything you call from `cy` affects local state.\n\nSince the configuration added or changed by `Cypress.config` is only in scope for the current spec file, you'd think that it should be `cy.config` and not `Cypress.config`…and you'd be right. The fact that `Cypress.config` affects local state is an artifact of the API evolving over time: `Cypress.config` used to affect global state—configuration added in one test spec file was available in other specs—but the Cypress team wisely made each spec run in isolation in [`3.0.0`](/llm/markdown/app/references/changelog.md#3-0-0) and by that time `Cypress.config` was public API.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 403
    },
    {
      "id": "api/cypress-api/config#not-all-config-values-can-be-changed-at-all-times",
      "doc_id": "api/cypress-api/config",
      "heading": "Not all config values can be changed at all times",
      "heading_level": 3,
      "content_markdown": "### Not all config values can be changed at all times\n\nSome configuration values are readonly and cannot be changed while running a test. Anything that's not directly under Cypress's control - like timeouts or environment variables - will be ignored at run-time. Be sure to review the list of [test configuration options](/llm/markdown/app/references/configuration.md#Test-Configuration).\n",
      "section": "api",
      "anchors": [
        "not-all-config-values-can-be-changed-at-all-times"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 71
    },
    {
      "id": "api/cypress-api/config#test-configuration-vs-cypress-config",
      "doc_id": "api/cypress-api/config",
      "heading": "Test Configuration vs Cypress.config()",
      "heading_level": 3,
      "content_markdown": "### Test Configuration vs `Cypress.config()`\n\nTo apply specific Cypress configuration values to a suite or test, you can pass a [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration) object to the test or suite function.\n\nWhile `Cypress.config()` changes configuration values through the entire spec file, using test configuration will only change configuration values during the suite or test where they are set. The values will then reset to the previous default values after the suite or test is complete.\n\nSee the full guide on [test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration).\n",
      "section": "api",
      "anchors": [
        "test-configuration-vs-cypress-config"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 107
    },
    {
      "id": "api/cypress-api/config#cypress-config-executes-synchronously",
      "doc_id": "api/cypress-api/config",
      "heading": "Cypress.config() executes Synchronously",
      "heading_level": 3,
      "content_markdown": "### `Cypress.config()` executes Synchronously\n\nIt's important to note that `Cypress.config()` executes synchronously and will not wait for the Cypress commands above it to execute. If you need to update your configuration mid-test, be sure to chain the [asynchronously Cypress command](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Commands-Are-Asynchronous).\n\n```\nit('using cy.then', () => {  cy.visit('/my-test_page')  cy.click('#download-html').then(() => {    Cypress.config('baseUrl', null)  })  cy.visit('/downloads/contents.html')})\n```\n",
      "section": "api",
      "anchors": [
        "cypress-config-executes-synchronously"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 73
    },
    {
      "id": "api/cypress-api/config#why-is-it-cypress-config-and-not-cy-config",
      "doc_id": "api/cypress-api/config",
      "heading": "Why is it Cypress.config and not cy.config?",
      "heading_level": 3,
      "content_markdown": "### Why is it `Cypress.config` and not `cy.config`?\n\nAs a rule of thumb anything you call from `Cypress` affects global state. Anything you call from `cy` affects local state.\n\nSince the configuration added or changed by `Cypress.config` is only in scope for the current spec file, you'd think that it should be `cy.config` and not `Cypress.config`…and you'd be right. The fact that `Cypress.config` affects local state is an artifact of the API evolving over time: `Cypress.config` used to affect global state—configuration added in one test spec file was available in other specs—but the Cypress team wisely made each spec run in isolation in [`3.0.0`](/llm/markdown/app/references/changelog.md#3-0-0) and by that time `Cypress.config` was public API.\n",
      "section": "api",
      "anchors": [
        "why-is-it-cypress-config-and-not-cy-config"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 149
    },
    {
      "id": "api/cypress-api/config#see-also",
      "doc_id": "api/cypress-api/config",
      "heading": "See also",
      "heading_level": 2,
      "content_markdown": "## See also\n\n*   [Cypress configuration](/llm/markdown/app/references/configuration.md)\n*   [Environment Variables & Secrets](/llm/markdown/app/guides/environment-variables.md)\n*   [cy.env()](/llm/markdown/api/commands/env.md) - Command for accessing environment variables\n*   [Cypress.expose()](/llm/markdown/api/cypress-api/expose.md) - API for public configuration values\n*   [Test Configuration](/llm/markdown/app/references/configuration.md#Test-Configuration)\n",
      "section": "api",
      "anchors": [
        "see-also"
      ],
      "path": "/llm/json/chunked/api/cypress-api/config.json",
      "token_estimate": 40
    }
  ]
}