---
title: "Public Environment Variables For Your Tests Using cypress-expose Plugin"
url: https://daily.dev/posts/public-environment-variables-for-your-tests-using-cypress-expose-plugin-kjidoxub0
source_url: https://glebbahmutov.com/blog/cypress-expose-plugin
type: article
source: "Gleb Bahmutov"
published: 2026-05-31T07:53:21.930Z
updated: 2026-05-31T09:07:33.422Z
tags: ["testing", "cypress"]
reading_time: 2
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Public Environment Variables For Your Tests Using cypress-expose Plugin

**[Gleb Bahmutov](https://daily.dev/sources/glebbahmutov)** · 2 min read · 0 upvotes · 0 comments

## Summary

Cypress v16 changed how environment variables work, making CYPRESS_-prefixed variables private by default and inaccessible outside test blocks. To fill the gap for passing public (non-secret) configuration values to specs, the author created the cypress-expose plugin. It reads any CYPRESS_EXPOSE_... process environment variable and exposes it via Cypress.expose in camel-case form, keeping secrets private via cy.env while making non-sensitive config values accessible anywhere in spec files. Setup requires adding the plugin to the setupNodeEvents callback in cypress.config.js.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://glebbahmutov.com/blog/cypress-expose-plugin>

## Similar posts on daily.dev

- [Environment Variable Access in Cypress v15.10.0\+: Migrating to cy.env\(\) and Cypress.expose\(\)](https://daily.dev/posts/environment-variable-access-in-cypress-v15-10-0-migrating-to-cy-env-and-cypress-expose--o2cvgwctt) · cypress · 0 upvotes · 0 comments
- [GHSA-96qw-h329-v5rg \(shakapacker\): Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles](https://daily.dev/posts/ghsa-96qw-h329-v5rg-shakapacker-shakapacker-has-environment-variable-leak-via-environmentplugin-t-hjubnchrn) · RUBYLAND · 0 upvotes · 0 comments
- [Now Available to Everyone: Write Cypress Tests in Natural Language with cy.prompt\(\)](https://daily.dev/posts/now-available-to-everyone-write-cypress-tests-in-natural-language-with-cy-prompt--nptavkt5u) · cypress · 24 upvotes · 1 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#cypress](https://daily.dev/tags/cypress)

[View this post on daily.dev](https://daily.dev/posts/public-environment-variables-for-your-tests-using-cypress-expose-plugin-kjidoxub0)
