summaryrefslogtreecommitdiff
path: root/cli/tools/test
diff options
context:
space:
mode:
authorAlexander Michaud <131308558+armichaud@users.noreply.github.com>2023-08-17 17:41:29 -0400
committerGitHub <noreply@github.com>2023-08-17 23:41:29 +0200
commitb5839eefcf02e62e9e77e8095f372ac06a523cba (patch)
tree1e1c1bf0f992936ce52bcfc6d568e5e787f7916b /cli/tools/test
parentf343391a9f97d29ad287f247c06aa370eb7cab50 (diff)
fix(test): JUnit reporter includes file, line and column attributes (#20174)
Closes #20156
Diffstat (limited to 'cli/tools/test')
-rw-r--r--cli/tools/test/reporters/junit.rs23
1 files changed, 17 insertions, 6 deletions
diff --git a/cli/tools/test/reporters/junit.rs b/cli/tools/test/reporters/junit.rs
index eb6479a59..a62c32dab 100644
--- a/cli/tools/test/reporters/junit.rs
+++ b/cli/tools/test/reporters/junit.rs
@@ -40,13 +40,24 @@ impl JunitTestReporter {
impl TestReporter for JunitTestReporter {
fn report_register(&mut self, description: &TestDescription) {
- self.cases.insert(
- description.id,
- quick_junit::TestCase::new(
- description.name.clone(),
- quick_junit::TestCaseStatus::skipped(),
- ),
+ let mut case = quick_junit::TestCase::new(
+ description.name.clone(),
+ quick_junit::TestCaseStatus::skipped(),
);
+ let file_name = description.location.file_name.clone();
+ let file_name = file_name.strip_prefix("file://").unwrap_or(&file_name);
+ case
+ .extra
+ .insert(String::from("filename"), String::from(file_name));
+ case.extra.insert(
+ String::from("line"),
+ description.location.line_number.to_string(),
+ );
+ case.extra.insert(
+ String::from("col"),
+ description.location.column_number.to_string(),
+ );
+ self.cases.insert(description.id, case);
}
fn report_plan(&mut self, _plan: &TestPlan) {}