Return non-zero exit code on test failure

And integrated test results with miette report.
This commit is contained in:
KtorZ
2022-12-14 18:41:31 +01:00
parent 3a9cc668fc
commit 87546e0abd
4 changed files with 80 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
use std::collections::BTreeMap;
use std::{env, path::PathBuf};
use std::{env, path::PathBuf, process};
use aiken_project::{
config::Config,
@@ -36,12 +36,21 @@ where
if let Err(err) = build_result {
err.report();
miette::bail!("Failed: {} error(s), {warning_count} warning(s)", err.len(),);
};
println!("\nFinished with {warning_count} warning(s)\n");
println!("{}", "Summary".purple().bold());
println!(
" {}, {}",
format!("{} error(s)", err.len()),
format!("{warning_count} warning(s)").yellow(),
);
process::exit(1);
} else {
println!("{}", "Summary".purple().bold());
println!(
" {}, {}",
"0 error",
format!("{warning_count} warning(s)").yellow(),
);
}
Ok(())
}