From 90631dc0b11255634c6b1420b2aa8c188ea7cb5d Mon Sep 17 00:00:00 2001 From: jcamiel Date: Thu, 23 Mar 2023 22:06:41 +0100 Subject: [PATCH] Add meta utf-8 charset to HTML report --- packages/hurl/src/report/html/report.rs | 19 ++----------------- .../src/report/html/resources/report.html | 5 ++++- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/packages/hurl/src/report/html/report.rs b/packages/hurl/src/report/html/report.rs index 44d2cef07..f4e66e997 100644 --- a/packages/hurl/src/report/html/report.rs +++ b/packages/hurl/src/report/html/report.rs @@ -50,21 +50,6 @@ pub fn write_report(dir_path: &Path, testcases: &[Testcase]) -> Result<(), Error message: format!("Issue writing to {}: {:?}", file_path.display(), why), }); } - - let file_path = dir_path.join("report.css"); - let mut file = match std::fs::File::create(&file_path) { - Err(why) => { - return Err(Error { - message: format!("Issue writing to {}: {:?}", file_path.display(), why), - }); - } - Ok(file) => file, - }; - if let Err(why) = file.write_all(include_bytes!("resources/report.css")) { - return Err(Error { - message: format!("Issue writing to {}: {:?}", file_path.display(), why), - }); - } Ok(()) } @@ -75,16 +60,16 @@ fn create_html_index(now: &str, hurl_results: &[HTMLResult]) -> String { let count_success = hurl_results.iter().filter(|result| result.success).count(); let percentage_success = percentage(count_success, count_total); let percentage_failure = percentage(count_failure, count_total); - + let css = include_str!("resources/report.css"); let rows = hurl_results .iter() .map(create_html_table_row) .collect::>() .join(""); - format!( include_str!("resources/report.html"), now = now, + css = css, count_total = count_total, count_success = count_success, count_failure = count_failure, diff --git a/packages/hurl/src/report/html/resources/report.html b/packages/hurl/src/report/html/resources/report.html index 9c4075885..1294a1b3d 100644 --- a/packages/hurl/src/report/html/resources/report.html +++ b/packages/hurl/src/report/html/resources/report.html @@ -1,8 +1,11 @@ + Test Report - +