From 9c35af76c1dfe6772d642d91385710c25f586604 Mon Sep 17 00:00:00 2001 From: Dylan Frankland Date: Fri, 23 Oct 2026 22:53:01 +0000 Subject: [PATCH 1/2] fix(cli): say what was searched and which flag failed when no test results 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) --- cli/src/context.rs | 19 ++++++++++++++++--- cli/tests/upload.rs | 8 ++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/cli/src/context.rs b/cli/src/context.rs index 0e16ab01..46cc635a 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -265,9 +265,22 @@ pub fn gather_post_test_context>( )?; if !allow_empty_test_results && file_set_builder.no_files_found() { - return Err(anyhow::anyhow!(InterruptingError::new( - "No test output files found to upload." - ))); + let searched = junit_path_wrappers + .iter() + .map(|j| j.junit_path.as_str()) + .collect::>() + .join(", "); + // Both spellings, since clap can't tell which was passed and the GitHub Action passes the alias. + return Err(anyhow::anyhow!(InterruptingError::new(format!( + "No test results found to upload{}. Failing because --allow-empty-test-results \ + (or its alias --allow-missing-junit-files) is false; set it to true to continue \ + without test results.", + if searched.is_empty() { + String::new() + } else { + format!(" in: {searched}") + } + )))); } tracing::info!("Total files pack and upload: {}", file_set_builder.count()); diff --git a/cli/tests/upload.rs b/cli/tests/upload.rs index b2d8ca91..5a5c673a 100644 --- a/cli/tests/upload.rs +++ b/cli/tests/upload.rs @@ -1475,6 +1475,14 @@ async fn upload_bundle_no_files_allow_missing_junit_files() { assert.stderr(predicate_fn.not()) }; + if matches!(flag, Flag::OffWithEquals | Flag::OffAliasWithEquals) { + assert = assert.code(70).stderr(predicate::str::contains( + "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.", + )); + } + // HINT: View CLI output with `cargo test -- --nocapture` println!("{assert}"); } From 5fd119baec8a7e5549e4906627aa405175963814 Mon Sep 17 00:00:00 2001 From: Dylan Frankland Date: Thu, 29 Oct 2026 17:28:45 +0000 Subject: [PATCH 2/2] fix(cli): bracket the searched paths in the empty-results error Co-Authored-By: Claude Opus 5.5 --- cli/src/context.rs | 2 +- cli/tests/upload.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/src/context.rs b/cli/src/context.rs index 46cc635a..8425abb4 100644 --- a/cli/src/context.rs +++ b/cli/src/context.rs @@ -278,7 +278,7 @@ pub fn gather_post_test_context>( if searched.is_empty() { String::new() } else { - format!(" in: {searched}") + format!(" in: <{searched}>") } )))); } diff --git a/cli/tests/upload.rs b/cli/tests/upload.rs index 5a5c673a..eed94abe 100644 --- a/cli/tests/upload.rs +++ b/cli/tests/upload.rs @@ -1477,7 +1477,7 @@ async fn upload_bundle_no_files_allow_missing_junit_files() { if matches!(flag, Flag::OffWithEquals | Flag::OffAliasWithEquals) { assert = assert.code(70).stderr(predicate::str::contains( - "No test results found to upload in: ./*. Failing because \ + "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.", ));