-
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1798f78
adds --posix-exit-codes cli flag for run mode
cacieprins a11cdae
add history entry
cacieprins 1cd41d3
clarify option/description table for --posix-exit-codes
cacieprins 524b211
expand docs on posix exit codes
cacieprins be5d892
prettify bash block
cacieprins 1fea008
fix changelog link
cacieprins bb8c67b
formatting
cacieprins e271a0a
Add posixExitCodes to module API page
jennifer-shehane 9371c71
changelog
jennifer-shehane dffaa3f
lint fix
jennifer-shehane f259c7c
Merge branch 'release/15.4.0' into feat/posix-exit-codes
jennifer-shehane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | | ||||||||||||||||||
| `--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,14 @@ documentation to learn more. | |||||||||||||||||
cypress run --port 8080 | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
#### `cypress run --posix-exit-codes` {#cypress-run-posix-exit-codes} | ||||||||||||||||||
|
||||||||||||||||||
Exit with POSIX exit code of 1 when there are test failures or if Cypress could not run. | ||||||||||||||||||
|
||||||||||||||||||
```shell | ||||||||||||||||||
cypress run --posix-exit-codes | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
#### `cypress run --project <project-path>` {#cypress-run-project-lt-project-path-gt} | ||||||||||||||||||
|
||||||||||||||||||
To see this in action we've set up an | ||||||||||||||||||
|
@@ -602,7 +611,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 +626,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 --posix-exit-codes | ||||||||||||||||||
... | ||||||||||||||||||
``` | ||||||||||||||||||
|
||||||||||||||||||
```text | ||||||||||||||||||
## print exit code on Mac or Linux | ||||||||||||||||||
Comment on lines
638
to
642
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.
Suggested change
Merge into one code block like the other examples above. 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. 👍 |
||||||||||||||||||
$ 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 +1000,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 | | ||||||||||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe cross-link here to the section
#Exit-code
?I completely missed this section when I glanced at the change 🤭
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.
Good idea! Updated here 524b211