Skip to content

feat: add cy.exec() Cypress 15 misc test compatibility #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MikeMcC399
Copy link
Collaborator

@MikeMcC399 MikeMcC399 commented Aug 14, 2025

Situation

PR cypress-io/cypress#32238 plans to update execa in Cypress from [email protected] to [email protected] and for cy.exec() to yield property exitCode instead of code.

PR #983 currently proposes to convert cypress/e2e/2-advanced-examples/misc.cy.js from using: Edit: closed in favor of this one

  • code (Cypress 14 and below) to instead
  • exitCode (Cypress 15 - currently unreleased)

causing a breaking change, in that the repo will then fail for Cypress 14, and scaffolded tests will also fail if a project is installed with Cypress 15 and then downgraded to Cypress 14 or below.

Change

In the test "'cy.exec() - execute a system command'" of cypress/e2e/2-advanced-examples/misc.cy.js, use Cypress.version to provide two different versions of cy.exec('pwd') appropriate for Cypress 14 and below, and for Cypress 15 respectively.

For publication on https://example.cypress.io/commands/misc update app/commands/misc.html to use Cypress 15 syntax with a comment to use code for Cypress 14 and below.

Add the npm package [email protected] to devDependencies. This is not essential, just good practice. Cypress already includes semver as a dependency (see https://www.npmjs.com/package/cypress?activeTab=dependencies) and so it is available anyway. Edit: removed because this does not work if Cypress is globally installed by npm.

Verification

On Ubuntu 24.04.3 LTS, Node.js 22.18.0 LTS

git clone https://github.com/cypress-io/cypress-example-kitchensink
cd cypress-example-kitchensink
npm ci
npm run start

In a separate terminal

npx cypress run -s cypress/e2e/2-advanced-examples/misc.cy.js

Confirm that all tests run.

git clone https://github.com/cypress-io/cypress
cd cypress
git switch breaking/update_execa
yarn
yarn cypress:run --project ../cypress-example-kitchensink -s ../cypress-example-kitchensink/cypress/e2e/2-advanced-examples/misc.cy.js

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399 MikeMcC399 self-assigned this Aug 14, 2025
@MikeMcC399 MikeMcC399 marked this pull request as ready for review August 14, 2025 09:53
@MikeMcC399 MikeMcC399 requested a review from AtofStryker August 14, 2025 09:53
@MikeMcC399 MikeMcC399 marked this pull request as draft August 14, 2025 10:25
@MikeMcC399

This comment was marked as resolved.

@MikeMcC399

This comment was marked as resolved.

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Aug 14, 2025

@MikeMcC399 MikeMcC399 marked this pull request as ready for review August 14, 2025 12:53
@jennifer-shehane jennifer-shehane merged commit eae360d into cypress-io:master Aug 15, 2025
12 checks passed
@cypress-app-bot
Copy link
Collaborator

🎉 This PR is included in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@MikeMcC399 MikeMcC399 deleted the cy-exec-cross-version-compatibility branch August 15, 2025 14:20
@jennifer-shehane
Copy link
Member

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Aug 15, 2025

@jennifer-shehane

@MikeMcC399 These tests began failing after this merge: https://app.circleci.com/pipelines/github/cypress-io/cypress/73417/workflows/ac918eaf-0377-4c50-8222-b46ac217b77a/jobs/3057018

@MikeMcC399
Copy link
Collaborator Author

@jennifer-shehane / @AtofStryker

Sorry, I didn't quite anticipate this happening, although I did write that the changes need to be coordinated.

In fact CircleCI clones the default branch master of the kitchensink repo without any regard for the version of cypress-examples-kitchensink which is configured in https://github.com/cypress-io/cypress/blob/develop/packages/example/package.json

@jennifer-shehane
Copy link
Member

@MikeMcC399 Yah, no worries. I did merge it. 😄 This makes sense. It is strange how we pull this into our tests honestly.

@MikeMcC399
Copy link
Collaborator Author

@jennifer-shehane

@MikeMcC399 Yah, no worries. I did merge it. 😄 This makes sense. It is strange how we pull this into our tests honestly.

This has highlighted some gaps in process and documentation in dealing with breaking API changes. It would be good to look at it again when things have settled down to try and make future transitions more robust.

In the meantime it would probably just be best to fast-track the execa PR so everything is matched up.

@AtofStryker
Copy link
Contributor

@jennifer-shehane

@MikeMcC399 Yah, no worries. I did merge it. 😄 This makes sense. It is strange how we pull this into our tests honestly.

This has highlighted some gaps in process and documentation in dealing with breaking API changes. It would be good to look at it again when things have settled down to try and make future transitions more robust.

In the meantime it would probably just be best to fast-track the execa PR so everything is matched up.

@MikeMcC399 I'm looking into the execa PR again today. There's a windows related failure that I need to address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants