test: hide progress spinners in test runs

Steady-tick spinner threads redraw straight to the real stderr, bypassing
both the harness capture and the per-test log files: 'Scaffolding' lines
from the pkh new tests kept leaking between test results. The scaffold
tests now pass a hidden draw target (the only MultiProgress not created
by the CLI).
This commit is contained in:
2026-09-17 15:32:55 +02:00
parent d2bb311f74
commit a7cd4244b2
2 changed files with 21 additions and 2 deletions
+15 -1
View File
@@ -9,7 +9,11 @@ pub mod logfmt;
/// yes/no confirmation
pub mod prompt;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use indicatif::{
MultiProgress, ProgressBar, ProgressStyle,
};
#[cfg(test)]
use indicatif::ProgressDrawTarget;
use std::path::Path;
use std::time::Duration;
@@ -38,6 +42,16 @@ pub(crate) fn spinner_style() -> ProgressStyle {
.unwrap()
}
/// Progress draw target for a [`MultiProgress`]: hidden in test runs
///
/// Steady-tick spinners redraw from a background thread straight to the real
/// stderr, bypassing both the test harness capture and the per-test log
/// files; in tests there is no terminal to animate anyway.
#[cfg(test)]
pub(crate) fn progress_draw_target() -> ProgressDrawTarget {
ProgressDrawTarget::hidden()
}
/// Style of a sized transfer: prefix on the first line, the bar on its own
/// indented line below so long prefixes cannot push it out of the terminal
pub(crate) fn transfer_style() -> ProgressStyle {