File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ function benchmark::print_results() {
101101 printf " Benchmark Results (avg ms)\n"
102102 print_line 80 " ="
103103 progress::blank_line
104+ if env::is_simple_output_enabled; then
105+ progress::refresh
106+ fi
104107
105108 local has_threshold=false
106109 for val in " ${_BENCH_MAX_MILLIS[@]} " ; do
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ function main::exec_tests() {
4949 printf ' %*s\n' " $TERMINAL_WIDTH " ' ' | tr ' ' ' .'
5050 env::print_verbose
5151 printf ' %*s\n' " $TERMINAL_WIDTH " ' ' | tr ' ' ' #'
52+ if env::is_simple_output_enabled; then
53+ progress::refresh
54+ fi
5255 fi
5356
5457 runner::load_test_files " $filter " " ${test_files[@]} "
Original file line number Diff line number Diff line change 22
33function progress::init() {
44 export PROGRESS_TOTAL=$1
5+ # Track the last rendered progress state so the bar can be redrawn
6+ export PROGRESS_CURRENT=0
57
68 if parallel::is_enabled || [[ ! -t 1 ]] || ! env::is_progress_enabled; then
79 _PROGRESS_ENABLED=false
@@ -15,6 +17,8 @@ function progress::render() {
1517 local current=$1
1618 local total=$2
1719
20+ PROGRESS_CURRENT=$current
21+
1822 if [[ " $_PROGRESS_ENABLED " != true ]]; then
1923 return
2024 fi
@@ -63,10 +67,17 @@ function progress::finish() {
6367 if command -v tput > /dev/null; then
6468 tput sc
6569 tput cup $(( $(tput lines) - 1 )) 0
66- printf ' %*s\n ' " $TERMINAL_WIDTH " ' '
70+ printf ' %*s' " $TERMINAL_WIDTH " ' '
6771 tput rc
6872 else
69- printf ' \n'
73+ printf ' \r%-*s' " $TERMINAL_WIDTH " ' '
74+ fi
75+ }
76+
77+ # Re-render the last progress bar if progress display is enabled
78+ function progress::refresh() {
79+ if [[ " $_PROGRESS_ENABLED " == true ]]; then
80+ progress::render " $PROGRESS_CURRENT " " $PROGRESS_TOTAL "
7081 fi
7182}
7283
Original file line number Diff line number Diff line change @@ -174,6 +174,10 @@ function runner::render_running_file_header() {
174174 progress::blank_line
175175 progress::blank_line
176176 printf " ${_COLOR_BOLD} %s${_COLOR_DEFAULT} " " Running $script "
177+ fi
178+
179+ if env::is_simple_output_enabled && env::is_verbose_enabled; then
180+ progress::refresh
177181 fi
178182}
179183
You can’t perform that action at this time.
0 commit comments