mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 17:58:17 +00:00
feat: make test dashboard optional (#1568)
This commit is contained in:
parent
97bcc486fd
commit
6f945c0c80
1 changed files with 17 additions and 2 deletions
|
@ -66,6 +66,14 @@ pub struct TestArgs {
|
|||
#[clap(long)]
|
||||
pub watch: bool,
|
||||
|
||||
/// Whether to render the dashboard.
|
||||
#[clap(long)]
|
||||
pub dashboard: bool,
|
||||
|
||||
/// Whether not to render the dashboard.
|
||||
#[clap(long)]
|
||||
pub no_dashboard: bool,
|
||||
|
||||
/// Whether to log verbose information.
|
||||
#[clap(long)]
|
||||
pub verbose: bool,
|
||||
|
@ -129,11 +137,15 @@ pub async fn test_main(args: TestArgs) -> Result<()> {
|
|||
|
||||
std::fs::create_dir_all(Path::new("target")).context("create target dir")?;
|
||||
|
||||
let out_file = if args.watch {
|
||||
let dashboard = (!args.no_dashboard) && (args.dashboard || args.watch);
|
||||
|
||||
let dashboard_path = "target/dashboard.typ";
|
||||
let out_file = if dashboard {
|
||||
test_info!("Info", "Dashboard is available at {dashboard_path}");
|
||||
write_atomic("target/testing-log.typ", include_str!("testing-log.typ"))
|
||||
.context("write log template")?;
|
||||
|
||||
let mut out_file = std::fs::File::create("test-watch.typ").context("create log file")?;
|
||||
let mut out_file = std::fs::File::create(dashboard_path).context("create log file")?;
|
||||
writeln!(out_file, "{LOG_PRELUDE}").context("write log")?;
|
||||
Some(Arc::new(Mutex::new(out_file)))
|
||||
} else {
|
||||
|
@ -185,6 +197,9 @@ pub async fn test_main(args: TestArgs) -> Result<()> {
|
|||
test_error!("Fatal:", "{err}");
|
||||
}
|
||||
log_info!("Tests finished in {:?}", instant.elapsed());
|
||||
if dashboard {
|
||||
log_hint!("Dashboard is available at {dashboard_path}");
|
||||
}
|
||||
log_hint!("Press 'h' for help");
|
||||
|
||||
config.args.update = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue