Skip to content

Commit fd73399

Browse files
fix: improve error message when no benchmarks are found
Handle the `NoBenchmarks` variant in `ReportConclusion` and display a warning when results are empty instead of silently showing nothing.
1 parent 7cd7a64 commit fd73399

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/api_client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ pub enum ReportConclusion {
9292
AcknowledgedFailure,
9393
Failure,
9494
MissingBaseRun,
95+
NoBenchmarks,
9596
Success,
9697
}
9798

@@ -105,6 +106,9 @@ impl Display for ReportConclusion {
105106
ReportConclusion::MissingBaseRun => {
106107
write!(f, "{}", style("Missing Base Run").yellow().bold())
107108
}
109+
ReportConclusion::NoBenchmarks => {
110+
write!(f, "{}", style("No Benchmarks").yellow().bold())
111+
}
108112
ReportConclusion::Success => write!(f, "{}", style("Success").green().bold()),
109113
}
110114
}

src/upload/poll_results.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ pub async fn poll_results(
7272
));
7373
}
7474

75-
if !response.run.results.is_empty() {
75+
if response.run.results.is_empty() {
76+
warn!(
77+
"No benchmarks were found in the run. Make sure your command runs benchmarks that are instrumented with a CodSpeed integration."
78+
);
79+
} else {
7680
end_group!();
7781
start_group!("Benchmark results");
7882

0 commit comments

Comments
 (0)