Skip to content

Commit

Permalink
feat: log treefmt command and output in tests
Browse files Browse the repository at this point in the history
Helps with debugging tests.

Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed Oct 15, 2024
1 parent d0e10fc commit 2176102
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"path"
"path/filepath"
"regexp"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 2176102

Please sign in to comment.