Skip to content

test: restrict example/env to Cypress <15.10 - #1888

Merged
jennifer-shehane merged 4 commits into
cypress-io:masterfrom
MikeMcC399:example-env-pre-15.10
Sep 9, 2026
Merged

test: restrict example/env to Cypress <15.10#1888
jennifer-shehane merged 4 commits into
cypress-io:masterfrom
MikeMcC399:example-env-pre-15.10

Conversation

@MikeMcC399

@MikeMcC399 MikeMcC399 commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

PREREQUISITE FOR CYPRESS 16 UPGRADE

Situation

Assessment

The env examples are still relevant for action users that have not upgraded to minimum Cypress 15.10. They are however incompatible with Cypress 16 and block upgrading the repo.

env continues to be available for GitHub Actions workflows for both secret and non-secret variables. Preserving various examples using env is therefore helpful for understanding how to use variables.

Change

Skip the tests in examples/env for Cypress >=15.10.0

Update code inline comments and documentation accordingly.

Verification

cd examples/env
npm install [email protected]
export CYPRESS_environmentName=staging CYPRESS_apiPort=4222 CYPRESS_host=http://api.dev.local
npm test
npm install [email protected]
npm test
npm install cypress@15
npm test
npm install cypress@16
npm test

Confirm that each test is successful.


Note

Low Risk
Changes are limited to example tests, lockfile, and documentation; no production action behavior is modified.

Overview
Prepares the repo for a Cypress 16 upgrade by keeping the legacy examples/env workflow and docs while stopping Cypress.env() assertions from running on Cypress 15.10.0+ (where that API is deprecated/removed).

The e2e specs in spec.cy.js and without-env.cy.js now use semver to run the original env checks only on older Cypress versions; on ≥15.10.0 they register a no-op test so CI still passes. example-env.yml and the README Env section are updated with migration notes and a pointer to example-expose.yml / the expose action input for non-sensitive config on modern Cypress.

Reviewed by Cursor Bugbot for commit 3c0051f. Bugbot is set up for automated code reviews on this repo. Configure here.

@cypress-app-bot

Copy link
Copy Markdown
Collaborator

@MikeMcC399 MikeMcC399 added type: enhancement New feature or request tests labels Sep 5, 2026
@MikeMcC399 MikeMcC399 self-assigned this Sep 5, 2026
Comment thread examples/env/cypress/e2e/spec.cy.js Outdated
Comment thread examples/env/cypress/e2e/without-env.cy.js Outdated

@jennifer-shehane jennifer-shehane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for surfacing all this @MikeMcC399, the approach makes sense to me. A few things:

  • example-env.yml still shows Cypress.env() in the inline comments which reads oddly right under the new header.
  • action.yml line 30 still says "Sets Cypress environment variables", worth matching the new README framing, like expose does.

With cypress pinned at 15.21.1, all four jobs now run only the placeholder. Should we pin this example below 15.10 so it actually exercises the legacy path?

@MikeMcC399

Copy link
Copy Markdown
Collaborator Author

@jennifer-shehane

Thanks for surfacing all this @MikeMcC399, the approach makes sense to me. A few things:

  • example-env.yml still shows Cypress.env() in the inline comments which reads oddly right under the new header.

I assume that you're just commenting without requesting a change

  • action.yml line 30 still says "Sets Cypress environment variables", worth matching the new README framing, like expose does.

I would address that separately, because that affects the action, not the example of using the action. Also the documentation history on https://docs.cypress.io/app/references/module-api would need extending as it does not describe the history of repurposing the Module API env parameter.

With cypress pinned at 15.21.1, all four jobs now run only the placeholder. Should we pin this example below 15.10 so it actually exercises the legacy path?

Pinning the example to a non-standard version would be messy. Renovate would try to update it, unless an exception were put in place, and Dependabot would regularly complain about vulnerabilities that are already resolved. I would not want to do that. I did test it on the old versions.

@jennifer-shehane
jennifer-shehane merged commit 17d764c into cypress-io:master Sep 9, 2026
99 checks passed
@MikeMcC399
MikeMcC399 deleted the example-env-pre-15.10 branch September 9, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants