Skip to content

Commit

Permalink
script_test: add -debug flag (#586)
Browse files Browse the repository at this point in the history
Add a -debug flag to enable verbose logging from git-spice during tests.
  • Loading branch information
abhinav authored Feb 21, 2025
1 parent f97fa7d commit 358004e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ import (
"go.abhg.dev/gs/internal/ui/uitest"
)

var _update = flag.Bool("update", false, "update golden files")
var (
_update = flag.Bool("update", false, "update golden files")
_debug = flag.Bool("debug", false, "enable debug logging")
)

func TestMain(m *testing.M) {
// Always override the secret stash with a memory stash
Expand Down Expand Up @@ -98,6 +101,10 @@ func TestScript(t *testing.T) {
defaultEnv["GIT_COMMITTER_NAME"] = "Test"
defaultEnv["GIT_COMMITTER_EMAIL"] = "[email protected]"

if *_debug {
defaultEnv["GIT_SPICE_VERBOSE"] = "true"
}

var shamhubCmd shamhub.Cmd

testscript.Run(t, testscript.Params{
Expand Down

0 comments on commit 358004e

Please sign in to comment.