-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs: adds --posix-exit-codes cli flag for run mode #6284
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
Changes from 7 commits
1798f78
a11cdae
1cd41d3
524b211
be5d892
1fea008
bb8c67b
e271a0a
9371c71
dffaa3f
f259c7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,7 @@ cypress run [options] | |
| `--no-runner-ui` | [Hides the Cypress Runner UI](#cypress-run-no-runner-ui) | | ||
| `--parallel` | [Run recorded specs in parallel across multiple machines](#cypress-run-parallel) | | ||
| `--port`,`-p` | [Override default port](#cypress-run-port-lt-port-gt) | | ||
| `--posix-exit-codes` | [Exit with a POSIX-compliant exit code](#cypress-run-posix-exit-codes) rather than the number of failed tests. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option needs to be added to the Module API doc: https://deploy-preview-6284--cypress-docs.netlify.app/app/references/module-api There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added here: e271a0a |
||
| `--project`, `-P` | [Path to a specific project](#cypress-run-project-lt-project-path-gt) | | ||
| `--quiet`, `-q` | [Reduce output to `stdout`](#cypress-run-quiet) | | ||
| `--record` | [Whether to record the test run](#cypress-run-record-key-lt-record-key-gt) | | ||
|
@@ -439,6 +440,16 @@ documentation to learn more. | |
cypress run --port 8080 | ||
``` | ||
|
||
#### `cypress run --posix-exit-codes` {#cypress-run-posix-exit-codes} | ||
|
||
This changes the default behavior of Cypress regarding exit codes. This flag causes Cypress to exit with POSIX exit code of 1 when there are test failures or if Cypress could not run, rather than the number of tests that failed. | ||
|
||
```shell | ||
cypress run --posix-exit-codes | ||
``` | ||
|
||
For more about Cypress' exit code behavior, see the [Exit Code section](/app/references/command-line#Exit-code). | ||
|
||
#### `cypress run --project <project-path>` {#cypress-run-project-lt-project-path-gt} | ||
|
||
To see this in action we've set up an | ||
|
@@ -602,7 +613,7 @@ $ echo $? | |
0 | ||
``` | ||
|
||
If there are any test failures, then the exit code will match the number of | ||
By default, if there are any test failures, then the exit code will match the number of | ||
tests that failed. | ||
|
||
```text | ||
|
@@ -617,6 +628,22 @@ $ echo $? | |
2 | ||
``` | ||
|
||
You can change this behavior by passing the `--posix-exit-codes` flag. When this flag is passed, | ||
the exit code will be 0 if all tests pass. If there are any test failures or if Cypress could not run, | ||
the exit code will be 1. | ||
|
||
```text | ||
## Spec with two failing tests | ||
$ cypress run | ||
... | ||
Tests Passing Failing | ||
✖ 1 of 1 failed (100%) 00:22 17 14 2 | ||
|
||
## print exit code on Mac or Linux | ||
$ echo $? | ||
1 | ||
``` | ||
|
||
If Cypress could not run for some reason (for example if no spec files were | ||
found) then the exit code will be 1. | ||
|
||
|
@@ -975,6 +1002,7 @@ and with Windows CMD and PowerShell terminal windows. | |
|
||
| Version | Changes | | ||
| ------------------------------------------ | ---------------------------------------------------------- | | ||
| [15.4.0](/app/references/changelog#15-4-0) | Added `--posix-exit-codes` flag to `cypress run` | | ||
| [12.6.0](/app/references/changelog#12-6-0) | Added `--auto-cancel-after-failures` flag to `cypress run` | | ||
| [5.4.0](/app/references/changelog) | Added `prune` subcommand to `cypress cache` | | ||
| [5.4.0](/app/references/changelog) | Added `--size` flag to `cypress cache list` subcommand | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.