Cypress.expose() supports suite- and test-level config overrides
Introduced 2026-06-09 · score 0.96
HOW TO USE IT
When a suite or test needs different public values, pass them in its test config as `{ expose: { key: value } }`; suite and test overrides merge, with test values taking precedence.
describe('checkout', { expose: { flow: 'guest' } }, () => {
it('uses suite and test values', { expose: { step: 'payment' } }, () => {
expect(Cypress.expose('flow')).to.eq('guest')
expect(Cypress.expose('step')).to.eq('payment')
})
})WHY THIS HELPS
Set different Cypress.expose() values for individual suites or tests.
REQUIREMENTS AND LIMITATIONS
- Version: 15.17.0
- suite/test config `expose` object: Object of public configuration values to override for the suite or test.
- `expose` object keys and values: Each key names an exposed variable and its value is the value to set; suite and test objects merge, and duplicate keys use the test-level value. No documented sub-key restriction.
- Prerequisite: Use only for public, non-sensitive values accessible in the browser context.
FIRST-PARTY EVIDENCE
- https://docs.cypress.io/app/references/changelog#15-17-0
- https://docs.cypress.io/api/cypress-api/expose
Check the installed version and the source before using it. Entry JSON