diff --git a/pkg/cmd/pipeline/pipeline_test.go b/pkg/cmd/pipeline/pipeline_test.go index 08ffe97..065e886 100644 --- a/pkg/cmd/pipeline/pipeline_test.go +++ b/pkg/cmd/pipeline/pipeline_test.go @@ -1,6 +1,7 @@ package pipeline import ( + "bytes" "testing" "github.com/tektoncd/cli/pkg/cli" @@ -10,6 +11,10 @@ func TestRoot(t *testing.T) { // Create a new cobra command. cmd := Command(&cli.TektonParams{}) + // Create a Buffer to capture the output. + out := new(bytes.Buffer) + cmd.SetOut(out) + // Execute the command. if err := cmd.Execute(); err != nil { t.Errorf("Failed to execute command: %v", err) diff --git a/pkg/cmd/pipelinerun/pipelinerun_test.go b/pkg/cmd/pipelinerun/pipelinerun_test.go index 60072f1..047a690 100644 --- a/pkg/cmd/pipelinerun/pipelinerun_test.go +++ b/pkg/cmd/pipelinerun/pipelinerun_test.go @@ -1,6 +1,7 @@ package pipelinerun import ( + "bytes" "testing" "github.com/tektoncd/cli/pkg/cli" @@ -10,6 +11,10 @@ func TestRoot(t *testing.T) { // Create a new cobra command. cmd := Command(&cli.TektonParams{}) + // Create a Buffer to capture the output. + out := new(bytes.Buffer) + cmd.SetOut(out) + // Execute the command. if err := cmd.Execute(); err != nil { t.Errorf("Failed to execute command: %v", err) diff --git a/pkg/cmd/root_test.go b/pkg/cmd/root_test.go index cc2718c..a4c3392 100644 --- a/pkg/cmd/root_test.go +++ b/pkg/cmd/root_test.go @@ -1,6 +1,7 @@ package cmd import ( + "bytes" "testing" "github.com/tektoncd/cli/pkg/cli" @@ -10,6 +11,10 @@ func TestRoot(t *testing.T) { // Create a new cobra command. cmd := Root(&cli.TektonParams{}) + // Create a Buffer to capture the output. + out := new(bytes.Buffer) + cmd.SetOut(out) + // Execute the command. if err := cmd.Execute(); err != nil { t.Errorf("Failed to execute command: %v", err)