Skip to content

Commit

Permalink
Merge pull request #630 from prog-supdex/fix_lefthook_env
Browse files Browse the repository at this point in the history
fix: handle LEFTHOOK_QUIET when there is no skip_output in config
  • Loading branch information
prog-supdex committed Feb 15, 2024
2 parents b66bae5 + f43cb23 commit ed10e37
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
9 changes: 5 additions & 4 deletions internal/log/skip_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func (s *SkipSettings) ApplySettings(tags string, skipOutput interface{}) {
for _, skipOption := range typedSkipOutput {
s.applySetting(skipOption.(string))
}
if tags != "" {
for _, skipOption := range strings.Split(tags, ",") {
s.applySetting(skipOption)
}
}

if tags != "" {
for _, skipOption := range strings.Split(tags, ",") {
s.applySetting(skipOption)
}
}
}
Expand Down
23 changes: 22 additions & 1 deletion internal/log/skip_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ import (

func TestSkipSetting(t *testing.T) {
for i, tt := range [...]struct {
tags string
settings interface{}
results map[string]bool
}{
{
tags: "",
settings: []interface{}{},
results: map[string]bool{},
},
{
tags: "",
settings: false,
results: map[string]bool{},
},
{
tags: "",
settings: []interface{}{"failure", "execution"},
results: map[string]bool{
"failure": true,
"execution": true,
},
},
{
tags: "",
settings: []interface{}{
"meta",
"summary",
Expand All @@ -50,6 +55,7 @@ func TestSkipSetting(t *testing.T) {
},
},
{
tags: "",
settings: true,
results: map[string]bool{
"meta": true,
Expand All @@ -63,11 +69,26 @@ func TestSkipSetting(t *testing.T) {
"empty_summary": true,
},
},
{
tags: "meta,summary,success,skips,empty_summary",
settings: nil,
results: map[string]bool{
"meta": true,
"summary": true,
"success": true,
"failure": false,
"skips": true,
"execution": false,
"execution_out": false,
"execution_info": false,
"empty_summary": true,
},
},
} {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
var settings SkipSettings

(&settings).ApplySettings("", tt.settings)
(&settings).ApplySettings(tt.tags, tt.settings)

if settings.SkipMeta() != tt.results["meta"] {
t.Errorf("expected SkipMeta to be %v", tt.results["meta"])
Expand Down

0 comments on commit ed10e37

Please sign in to comment.