Skip to content

fix(cli): say what was searched and which flag failed when no test results are found - #1252

Merged
trunk-io[bot] merged 2 commits into
mainfrom
dylan/trunk-19074-empty-results-flag
Oct 29, 2026
Merged

trunk-io[bot] merged 2 commits into
mainfrom
dylan/trunk-19074-empty-results-flag

Conversation

@dfrankland

Copy link
Copy Markdown
Member

With --allow-empty-test-results=false, an upload that finds no test results exits 70 with just "No test output files found to upload." That message doesn't say where the CLI looked or why it failed instead of carrying on. The GitHub Action passes the flag's alias, --allow-missing-junit-files, from its allow-missing-junit-files input, so the name the user typed is not the name in the CLI's help. Part of TRUNK-19074 (ask 2).

What changes. The message names where the CLI looked and the flag that caused the failure:

Error Encountered
No test results found to upload in: ./*. Failing because --allow-empty-test-results (or its alias --allow-missing-junit-files) is false; set it to true to continue without test results.
For more help, contact us at https://slack.trunk.io/
Errors occurred during execution, returning exit code: 70
  • "In:" lists every entry in junit_path_wrappers. That's the --junit-paths globs, plus the files a Bazel BEP, xcresult or swift-test xUnit input resolves to. If the list is empty, for example a BEP whose results were all cached, the "in:" part is left out.
  • Both spellings of the flag are named, because clap can't tell which one was passed. The env var, TRUNK_ALLOW_EMPTY_TEST_RESULTS, is left out to keep the line readable.
  • "Continue without test results" rather than "succeed": with the flag on, the exit code is still the test process's.
  • It's still an InterruptingError (exit 70), and the error rendering is unchanged.

Testing.

  • upload_bundle_no_files_allow_missing_junit_files now also checks exit code 70 and the new message for --allow-empty-test-results=false and --allow-missing-junit-files=false.
  • cargo nextest run -p trunk-analytics-cli --test upload: 58 of 61 pass. The 3 swift-test xUnit tests (upload_bundle_using_swift_test_xunit, swift_test_xunit_paths_are_globs, a_swift_test_xunit_file_reached_twice_is_uploaded_once) fail on my machine with "got no file from its declaration". They fail the same way on main without this change, so I'm relying on CI for them.
  • rustfmt --check on the changed files: clean.
  • cargo clippy -p trunk-analytics-cli --all-targets: no warnings on the changed lines.

🤖 Generated with Claude Code

@trunk-io

trunk-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.62%. Comparing base (41f781f) to head (5fd119b).

Files with missing lines Patch % Lines
cli/src/context.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1252      +/-   ##
==========================================
+ Coverage   85.42%   85.62%   +0.20%     
==========================================
  Files          86       86              
  Lines       19235    19241       +6     
==========================================
+ Hits        16431    16475      +44     
+ Misses       2804     2766      -38     

☔ 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-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

@trunk-io

trunk-io Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@TylerJang27 TylerJang27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy nit

Comment thread cli/src/context.rs Outdated
if searched.is_empty() {
String::new()
} else {
format!(" in: {searched}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: " in: <{searched}>"

Suggested change
format!(" in: {searched}")
format!(" in: <{searched}>")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't love brackets, but I'd prefer this or remove the period and put "Failing because..." on the next line

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Went with the brackets: No test results found to upload in: <./*>. Failing because …

Comment thread cli/tests/upload.rs Outdated

if matches!(flag, Flag::OffWithEquals | Flag::OffAliasWithEquals) {
assert = assert.code(70).stderr(predicate::str::contains(
"No test results found to upload in: ./*. Failing because \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"No test results found to upload in: ./*. Failing because \
"No test results found to upload in: <./*>. Failing because \

@dfrankland
dfrankland force-pushed the dylan/trunk-19074-empty-results-flag branch from cc1aaf5 to a07f569 Compare October 27, 2026 20:42
dfrankland and others added 2 commits October 29, 2026 17:28
…sults are found

With --allow-empty-test-results=false (or its alias
--allow-missing-junit-files=false), an upload that finds no test results
exits 70 with just "No test output files found to upload." It now names
where it looked and the flag that made it fail:

  No test results found to upload in: ./*. Failing because
  --allow-empty-test-results (or its alias --allow-missing-junit-files) is
  false; set it to true to continue without test results.

Both spellings are named because clap can't tell which was passed, and
the GitHub Action passes the alias.

Part of TRUNK-19074.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dfrankland
dfrankland force-pushed the dylan/trunk-19074-empty-results-flag branch from a07f569 to 5fd119b Compare October 29, 2026 17:40
@dfrankland

Copy link
Copy Markdown
Member Author

/trunk merge

@trunk-io
trunk-io Bot merged commit f61b8af 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