Skip to content

Commit 1798f78

Browse files
committed
adds --posix-exit-codes cli flag for run mode
1 parent 8f6cda6 commit 1798f78

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/app/references/command-line.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ cypress run [options]
217217
| `--no-runner-ui` | [Hides the Cypress Runner UI](#cypress-run-no-runner-ui) |
218218
| `--parallel` | [Run recorded specs in parallel across multiple machines](#cypress-run-parallel) |
219219
| `--port`,`-p` | [Override default port](#cypress-run-port-lt-port-gt) |
220+
| `--posix-exit-codes` | [Exit with a POSIX exit code](#cypress-run-posix-exit-codes) |
220221
| `--project`, `-P` | [Path to a specific project](#cypress-run-project-lt-project-path-gt) |
221222
| `--quiet`, `-q` | [Reduce output to `stdout`](#cypress-run-quiet) |
222223
| `--record` | [Whether to record the test run](#cypress-run-record-key-lt-record-key-gt) |
@@ -439,6 +440,14 @@ documentation to learn more.
439440
cypress run --port 8080
440441
```
441442
443+
#### `cypress run --posix-exit-codes` {#cypress-run-posix-exit-codes}
444+
445+
Exit with POSIX exit code of 1 when there are test failures or if Cypress could not run.
446+
447+
```shell
448+
cypress run --posix-exit-codes
449+
```
450+
442451
#### `cypress run --project <project-path>` {#cypress-run-project-lt-project-path-gt}
443452
444453
To see this in action we've set up an
@@ -602,7 +611,7 @@ $ echo $?
602611
0
603612
```
604613
605-
If there are any test failures, then the exit code will match the number of
614+
By default, if there are any test failures, then the exit code will match the number of
606615
tests that failed.
607616
608617
```text
@@ -617,6 +626,22 @@ $ echo $?
617626
2
618627
```
619628
629+
You can change this behavior by passing the `--posix-exit-codes` flag. When this flag is passed,
630+
the exit code will be 0 if all tests pass. If there are any test failures, or if Cypress could not run,
631+
the exit code will be 1.
632+
633+
```text
634+
## Spec with two failing tests
635+
$ cypress run --posix-exit-codes
636+
...
637+
```
638+
639+
```text
640+
## print exit code on Mac or Linux
641+
$ echo $?
642+
1
643+
```
644+
620645
If Cypress could not run for some reason (for example if no spec files were
621646
found) then the exit code will be 1.
622647

0 commit comments

Comments
 (0)