Skip to content

Commit 76d4270

Browse files
committed
fix: update output file paths for report and Excel generation
- Changed the output path for the test report and Excel file to the 'output' directory. - Added directory creation for the output path if it does not exist.
1 parent 89d944c commit 76d4270

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,8 @@ fn run_all_tests() -> Result<()> {
811811
("multi", vec!["--multi", "src", "."])
812812
];
813813

814-
let mut report_file = File::create("codestate_runall_report.txt")?;
814+
let _ = std::fs::create_dir_all("output");
815+
let mut report_file = File::create("output/codestate_runall_report.txt")?;
815816
writeln!(report_file, "CodeState --runall Test Report\n")?;
816817

817818
// Try to get the current executable path, fallback to "codestate"
@@ -878,7 +879,7 @@ fn run_all_tests() -> Result<()> {
878879
println!("Failed: {}", fail_count);
879880
println!("Success Rate: {:.2}%", success_rate);
880881
println!("Time taken: {:?}", test_elapsed);
881-
println!("Details saved to codestate_runall_report.txt");
882+
println!("Details saved to output/codestate_runall_report.txt");
882883

883884
if fail_count > 0 {
884885
println!("\nFailed Tests:");

src/visualizer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,10 @@ pub fn generate_excel(stats: &HashMap<String, ExtStats>, details: Option<&[Unifi
10801080
}
10811081
}
10821082

1083-
let path = output.map(|s| s.as_str()).unwrap_or("codestate_report.xlsx");
1083+
let path = output.map(|s| s.as_str()).unwrap_or("output/codestate_report.xlsx");
1084+
if let Some(parent) = std::path::Path::new(path).parent() {
1085+
let _ = std::fs::create_dir_all(parent);
1086+
}
10841087
if let Err(e) = workbook.save(path) {
10851088
eprintln!("! Failed to write Excel file {}: {}", path, e);
10861089
} else {

0 commit comments

Comments
 (0)