From 00341410f86db0ab0b3edf393eaa642405dcf028 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Fri, 20 Feb 2026 13:06:30 -0500 Subject: [PATCH] add and respect the --no-final-table display option At the end of "yath test", you get a summary of the test run in an ASCII art box, which is maybe fine, but it will break up filenames if they're long, like: +-------------------------------+ | filename | +-------------------------------+ | t/some-system/important-test- | | of-your-code.t | +-------------------------------+ ...and then you can't copy the filename from the terminal. This can be a pain, and the pretty-printing here isn't necessarily getting us much. This commit adds --no-final-table, which affects "yath test", causing it to instead print the final output more like this: Failed tests: - t/some-system/important-test-of-your-code.t It still includes job id and subtest information. Co-Authored-By: Claude --- lib/App/Yath/Command/test.pm | 69 +++++++++++++++++++++++++++++++++ lib/App/Yath/Options/Display.pm | 6 +++ 2 files changed, 75 insertions(+) diff --git a/lib/App/Yath/Command/test.pm b/lib/App/Yath/Command/test.pm index 67affced5..7370a2edf 100644 --- a/lib/App/Yath/Command/test.pm +++ b/lib/App/Yath/Command/test.pm @@ -675,6 +675,9 @@ sub render_final_data { return if $self->settings->display->quiet > 1; + return $self->_render_final_data_plainly($final_data) + if $self->settings->display->no_final_table; + if (my $rows = $final_data->{retried}) { print "\nThe following jobs failed at least once:\n"; print join "\n" => table( @@ -713,6 +716,72 @@ sub render_final_data { } } +sub _render_final_data_plainly { + my $self = shift; + my ($final_data) = @_; + + return if $self->settings->display->quiet > 1; + + if (my $rows = $final_data->{retried}) { + print "\nThe following jobs failed at least once:\n"; + for my $row (@$rows) { + print "- filename: $row->[2]\n"; + print " job_id: $row->[0]\n"; + print " times_run: $row->[1]\n"; + print " succeeded_eventually: $row->[3]\n"; + } + } + + if (my $rows = $final_data->{failed}) { + print "\nThe following jobs failed:\n"; + for my $row (@$rows) { + print "- filename: $row->[1]\n"; + print " job_id: $row->[0]\n"; + if ($row->[2]) { + print " subtests:\n"; + my @paths = _subtest_paths($row->[2]); + print " - $_\n" for @paths; + } + } + } + + if (my $rows = $final_data->{halted}) { + print "\nThe following jobs requested all testing be halted:\n"; + for my $row (@$rows) { + print "- filename: $row->[1]\n"; + print " job_id: $row->[0]\n"; + print " reason: $row->[2]\n" if $row->[2]; + } + } + + if (my $rows = $final_data->{unseen}) { + print "\nThe following jobs never ran:\n"; + for my $row (@$rows) { + print "- filename: $row->[1]\n"; + print " job_id: $row->[0]\n"; + } + } +} + +sub _subtest_paths { + my ($map) = @_; + + my @paths; + my @todo = @$map; + my @state; + while (my $st = shift @todo) { + if (!ref($st)) { + pop @state if $st eq 'pop'; + next; + } + push @state, $st->[0]; + push @paths, join(' -> ', @state); + unshift @todo, (@{$st->[1]}, 'pop'); + } + + return @paths; +} + sub stringify_subtest_map { my ($map) = @_; diff --git a/lib/App/Yath/Options/Display.pm b/lib/App/Yath/Options/Display.pm index 4ddc0cecb..9765a7468 100644 --- a/lib/App/Yath/Options/Display.pm +++ b/lib/App/Yath/Options/Display.pm @@ -34,6 +34,12 @@ option_group {prefix => 'display', category => "Display Options"} => sub { default => 0, ); + option no_final_table => ( + type => 'b', + description => "When printing final results, don't use table-style display", + default => 0, + ); + option show_times => ( short => 'T', description => 'Show the timing data for each job',