From 39774dcd09c13f9266b1a336fb844a5e4b4c09d0 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Tue, 15 Oct 2024 17:17:21 +0100 Subject: [PATCH] feat: log treefmt command and output in tests Helps with debugging tests. Signed-off-by: Brian McGee --- cmd/root_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/root_test.go b/cmd/root_test.go index 71d0b238..e1303caf 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -9,6 +9,7 @@ import ( "path" "path/filepath" "regexp" + "strings" "testing" "time" @@ -1239,6 +1240,8 @@ func TestRunInSubdir(t *testing.T) { func treefmt(t *testing.T, args ...string) ([]byte, *stats.Stats, error) { t.Helper() + t.Logf("treefmt %s", strings.Join(args, " ")) + tempDir := t.TempDir() tempOut := test.TempFile(t, tempDir, "combined_output", nil) @@ -1294,6 +1297,8 @@ func treefmt(t *testing.T, args ...string) ([]byte, *stats.Stats, error) { t.Fatal(fmt.Errorf("failed to read temp output: %w", readErr)) } + t.Log(string(out)) + return out, statz, cmdErr }