Skip to content

fix(cli): fail when test's command can't be started - #1250

Merged
trunk-io[bot] merged 1 commit into
mainfrom
dylan/cli-test-fails-when-command-cannot-start
Oct 29, 2026
Merged

trunk-io[bot] merged 1 commit into
mainfrom
dylan/cli-test-fails-when-command-cannot-start

Conversation

@dfrankland

Copy link
Copy Markdown
Member

trunk-analytics-cli test -- <command> exited 0 when the command couldn't be started, for example because of a typo in its name. It printed "Unable to connect to trunk's server", so a CI job with a broken test command passed. Found while surveying exit codes for TRUNK-22762.

Why. Starting the process fails with an io::Error. The error report treats any io::Error at the root of an error as a refused connection, and those exit 0 by design, so CI isn't blocked when Trunk is unreachable.

What changes. The failure is now raised as an InterruptingError, like the CLI's other can't-continue errors (for example "No test output files found to upload."). test exits 70 and prints:

Error Encountered
Couldn't run the test command `definitely-not-a-command`: No such file or directory (os error 2)
For more help, contact us at https://slack.trunk.io/
Errors occurred during execution, returning exit code: 70

Release note. A test run whose command can't be started now fails with exit code 70 instead of passing.

Testing.

  • New test_command_fails_when_the_command_cannot_be_started checks for exit code 70, the new message, no "Unable to connect", and no requests to Trunk. It fails on main, where the run exits 0.
  • cargo test -p trunk-analytics-cli --test test: all pass.
  • cargo clippy -p trunk-analytics-cli --all-targets: no new warnings.

🤖 Generated with Claude Code

@trunk-io

trunk-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@trunk-staging-io

trunk-staging-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
pending_quarantine_test should be quarantined when run with variant A test marked as pending was expected to fail but unexpectedly passed. Logs ↗︎
variant_quarantine_test should be quarantined when run with variant The quarantined variant test failed because it expected 2 + 2 to equal 5, but the result was 4. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.62%. Comparing base (41f781f) to head (ec1cb62).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1250      +/-   ##
==========================================
+ Coverage   85.42%   85.62%   +0.20%     
==========================================
  Files          86       86              
  Lines       19235    19247      +12     
==========================================
+ Hits        16431    16480      +49     
+ Misses       2804     2767      -37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trunk-io

trunk-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
pending_quarantine_test should be quarantined when run with variant A test marked as pending was expected to fail but unexpectedly passed. Logs ↗︎
variant_quarantine_test should be quarantined when run with variant The test failed because it expected 2 + 2 to equal 5, but the result was 4. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

`trunk-analytics-cli test -- <command>` exited 0 when the command
couldn't be started, for example because of a typo in its name. It
printed "Unable to connect to trunk's server", so a CI job with a broken
test command passed.

The error from starting the process is an io::Error, which the error
report treats as a refused connection, and those exit 0 by design. Now
it's raised like the CLI's other can't-continue errors, so `test` exits
70 and prints "Couldn't run the test command `<command>`: <reason>".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dfrankland
dfrankland force-pushed the dylan/cli-test-fails-when-command-cannot-start branch from 4fff580 to ec1cb62 Compare October 29, 2026 17:40
@dfrankland

Copy link
Copy Markdown
Member Author

/trunk merge

@trunk-io
trunk-io Bot merged commit 33b34b8 into main Oct 29, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants