Skip to content

Conversation

cacieprins
Copy link
Contributor

@cacieprins cacieprins commented Sep 30, 2025

Additional details

Steps to test

As in the added system test, cypress run --posix-exit-codes against a spec with multiple test failures; assert that the exit code is 1 rather than the number of tests that fail.

How has the user experience changed?

PR Tasks


Note

Adds --posix-exit-codes to cypress run and plumbs it through CLI, server, and types so runs exit 1 on any failures (0 on success), with tests and changelog updates.

  • CLI:
    • Add --posix-exit-codes flag and help text in cli/lib/cli.ts and plumb option via cli/lib/exec/run.ts and cli/lib/util.ts (posixExitCodes).
  • Server:
    • In packages/server/lib/cypress.ts, if options.posixExitCodes is set, exit 1 when results.totalFailed > 0, else 0.
    • Wire CLI arg in packages/server/lib/util/args.js (allow list + alias for posix-exit-codes).
  • Types:
    • Add posixExitCodes to cli/types/cypress-npm-api.d.ts and packages/types/src/modeOptions.ts.
  • Tests:
    • Unit tests for CLI option and arg propagation; update snapshots.
    • System tests system-tests/test/posix_exit_codes_spec.ts validating exit codes; add pass-through in system-tests/lib/system-tests.ts.
  • Docs/Changelog:
    • Update cli/CHANGELOG.md with new feature entry.

Written by Cursor Bugbot for commit 4696ca3. This will update automatically on new commits. Configure here.

@cacieprins cacieprins changed the title Feat 32605 posix exit codes feat: --posix-exit-codes cli flag in run mode Sep 30, 2025
Copy link

cypress bot commented Sep 30, 2025

cypress    Run #66029

Run Properties:  status check passed Passed #66029  •  git commit 4696ca3637: Apply suggestion from @jennifer-shehane
Project cypress
Branch Review feat-32605-posix-exit-codes
Run status status check passed Passed #66029
Run duration 09m 04s
Commit git commit 4696ca3637: Apply suggestion from @jennifer-shehane
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 694
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 130
View all changes introduced in this branch ↗︎

@cacieprins cacieprins marked this pull request as ready for review October 1, 2025 14:27
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cacieprins I'm not sure how to mention this, but this also fixes a bug where if you opt into this - then tests with a number of failures that are a multiple of 256 will now properly send an exit code that will fail instead of exitCode=0. Maybe another line item in the bugfixes????

@cacieprins
Copy link
Contributor Author

@cacieprins I'm not sure how to mention this, but this also fixes a bug where if you opt into this - then tests with a number of failures that are a multiple of 256 will now properly send an exit code that will fail instead of exitCode=0. Maybe another line item in the bugfixes????

Makes sense! posix exit codes are generally 8 bits; most shells handle exit codes >255 as modulo 256.

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
cursor[bot]

This comment was marked as outdated.

@jennifer-shehane jennifer-shehane mentioned this pull request Oct 1, 2025
18 tasks
@cacieprins cacieprins merged commit 14beae3 into develop Oct 2, 2025
89 of 92 checks passed
@cacieprins cacieprins deleted the feat-32605-posix-exit-codes branch October 2, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--posix-exit-codes flag for run/record mode Exit codes for cli
3 participants