summaryrefslogtreecommitdiff
path: root/cli/tools/bench/reporters.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-12-05 09:26:06 -0700
committerGitHub <noreply@github.com>2023-12-05 09:26:06 -0700
commit4a9f42950140b36b1916ab0e0320d721223b1095 (patch)
tree772f89bb86f9c9120700de6ae6859b0d9a704da6 /cli/tools/bench/reporters.rs
parentce83a849a4612a170b08b4cd2a8e78c6456cdcf4 (diff)
refactor(cli): refactor bench/test for future module changes (#21460)
Extracting some refactorings for the module work that will land in https://github.com/denoland/deno_core/pull/359/
Diffstat (limited to 'cli/tools/bench/reporters.rs')
-rw-r--r--cli/tools/bench/reporters.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/tools/bench/reporters.rs b/cli/tools/bench/reporters.rs
index 35b4a229c..a3e3f85d1 100644
--- a/cli/tools/bench/reporters.rs
+++ b/cli/tools/bench/reporters.rs
@@ -12,6 +12,7 @@ pub trait BenchReporter {
fn report_wait(&mut self, desc: &BenchDescription);
fn report_output(&mut self, output: &str);
fn report_result(&mut self, desc: &BenchDescription, result: &BenchResult);
+ fn report_uncaught_error(&mut self, origin: &str, error: Box<JsError>);
}
#[derive(Debug, Serialize)]
@@ -91,6 +92,8 @@ impl BenchReporter for JsonReporter {
});
}
}
+
+ fn report_uncaught_error(&mut self, _origin: &str, _error: Box<JsError>) {}
}
pub struct ConsoleReporter {
@@ -301,4 +304,15 @@ impl BenchReporter for ConsoleReporter {
fn report_end(&mut self, _: &BenchReport) {
self.report_group_summary();
}
+
+ fn report_uncaught_error(&mut self, _origin: &str, error: Box<JsError>) {
+ println!(
+ "{}: {}",
+ colors::red_bold("error"),
+ format_test_error(&error)
+ );
+ println!("This error was not caught from a benchmark and caused the bench runner to fail on the referenced module.");
+ println!("It most likely originated from a dangling promise, event/timeout handler or top-level code.");
+ println!();
+ }
}