summaryrefslogtreecommitdiff
path: root/cli/tools/test/reporters/tap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/test/reporters/tap.rs')
-rw-r--r--cli/tools/test/reporters/tap.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/cli/tools/test/reporters/tap.rs b/cli/tools/test/reporters/tap.rs
index 62cb58a83..ea68ddd43 100644
--- a/cli/tools/test/reporters/tap.rs
+++ b/cli/tools/test/reporters/tap.rs
@@ -20,11 +20,16 @@ pub struct TapTestReporter {
n: usize,
step_n: usize,
step_results: HashMap<usize, Vec<(TestStepDescription, TestStepResult)>>,
+ failure_format_options: TestFailureFormatOptions,
}
#[allow(clippy::print_stdout)]
impl TapTestReporter {
- pub fn new(cwd: Url, is_concurrent: bool) -> TapTestReporter {
+ pub fn new(
+ cwd: Url,
+ is_concurrent: bool,
+ failure_format_options: TestFailureFormatOptions,
+ ) -> TapTestReporter {
TapTestReporter {
cwd,
is_concurrent,
@@ -33,6 +38,7 @@ impl TapTestReporter {
n: 0,
step_n: 0,
step_results: HashMap::new(),
+ failure_format_options,
}
}
@@ -45,6 +51,7 @@ impl TapTestReporter {
}
fn print_diagnostic(
+ &self,
indent: usize,
failure: &TestFailure,
location: DiagnosticLocation,
@@ -56,7 +63,7 @@ impl TapTestReporter {
// YAML is a superset of JSON, so we can avoid a YAML dependency here.
// This makes the output less readable though.
let diagnostic = serde_json::to_string(&json!({
- "message": failure.to_string(),
+ "message": failure.format(&self.failure_format_options),
"severity": "fail".to_string(),
"at": location,
}))
@@ -102,7 +109,7 @@ impl TapTestReporter {
Self::print_line(4, status, self.step_n, &desc.name, directive);
if let TestStepResult::Failed(failure) = result {
- Self::print_diagnostic(
+ self.print_diagnostic(
4,
failure,
DiagnosticLocation {
@@ -171,7 +178,7 @@ impl TestReporter for TapTestReporter {
Self::print_line(0, status, self.n, &description.name, directive);
if let TestResult::Failed(failure) = result {
- Self::print_diagnostic(
+ self.print_diagnostic(
0,
failure,
DiagnosticLocation {