diff --git a/docs/api/commands/exec.mdx b/docs/api/commands/exec.mdx index a1ecf80538..7c46fdc9d7 100644 --- a/docs/api/commands/exec.mdx +++ b/docs/api/commands/exec.mdx @@ -57,7 +57,7 @@ Pass in an options object to change the default behavior of `cy.exec()`. `cy.exec()` yields an object with the following properties: -- `code` +- `exitCode` - `stdout` - `stderr` @@ -80,7 +80,7 @@ is great for: cy.exec('npm run build').then((result) => { // yields the 'result' object // { - // code: 0, + // exitCode: 0, // stdout: "Files successfully built", // stderr: "" // } @@ -90,7 +90,7 @@ cy.exec('npm run build').then((result) => { #### Seed the database and assert it was successful ```javascript -cy.exec('rake db:seed').its('code').should('eq', 0) +cy.exec('rake db:seed').its('exitCode').should('eq', 0) ``` #### Run an arbitrary script and assert its output @@ -133,7 +133,7 @@ cy.exec('npm run build', { timeout: 20000 }) ```javascript cy.exec('man bear pig', { failOnNonZeroExit: false }).then((result) => { - expect(result.code).to.eq(1) + expect(result.exitCode).to.eq(1) expect(result.stderr).to.contain('No manual entry for bear') }) ``` @@ -237,6 +237,12 @@ the following: alt="console.log exec" /> +## History + +| Version | Changes | +| ------------------------------------------ | ------------------------------------- | +| [15.0.0](/app/references/changelog#15-0-0) | Renamed property `code` to `exitCode` | + ## See also - [`cy.readFile()`](/api/commands/readfile) diff --git a/docs/app/references/changelog.mdx b/docs/app/references/changelog.mdx index 9392c1a03e..46890187b3 100644 --- a/docs/app/references/changelog.mdx +++ b/docs/app/references/changelog.mdx @@ -12,7 +12,6 @@ sidebar_label: Changelog _Released 7/29/2025 (PENDING)_ - ## 14.5.4 _Released 8/07/2025_ diff --git a/docs/app/references/migration-guide.mdx b/docs/app/references/migration-guide.mdx index c4751e9dc9..1dca022f4d 100644 --- a/docs/app/references/migration-guide.mdx +++ b/docs/app/references/migration-guide.mdx @@ -20,6 +20,22 @@ Cypress requires [Node.js](https://nodejs.org/en) in order to install the Cypres Node.js versions 18 and 23 are no longer supported. [See Node's release schedule](https://github.com/nodejs/Release). +### cy.exec code property renamed + +The `code` property on [`cy.exec()`](/api/commands/exec) has been renamed to `exitCode`. + +Before{' '} + +```javascript +cy.exec('rake db:seed').its('code').should('eq', 0) +``` + +After + +```javascript +cy.exec('rake db:seed').its('exitCode').should('eq', 0) +``` + ### Unsupported Linux Distributions Prebuilt binaries for Linux are no longer compatible with Linux distributions based on glibc `<2.31`.