github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/cmd/syft/internal/commands/commands_test.go (about)

     1  package commands
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	gologgerredact "github.com/anchore/go-logger/adapter/redact"
     8  	"github.com/anchore/syft/internal/redact"
     9  )
    10  
    11  func TestMain(m *testing.M) {
    12  	// Initialize global state needed to test clio/cobra commands directly
    13  	// Should be kept minimal.
    14  
    15  	// Initialize redact store once for all tests in the commands package
    16  	// Redact store must be wired up here because syft will panic unless
    17  	// a redact store is wired up exactly once
    18  	redact.Set(gologgerredact.NewStore())
    19  	os.Exit(m.Run())
    20  }