Skip to content

Commit

Permalink
fix: handle LEFTHOOK_QUIET when there is no skip_output in config
Browse files Browse the repository at this point in the history
  • Loading branch information
prog-supdex committed Feb 15, 2024
1 parent b66bae5 commit 93d0d38
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 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
17 changes: 17 additions & 0 deletions internal/log/skip_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,21 @@ func TestSkipSetting(t *testing.T) {
}
})
}

t.Run("ApplySettings with non-empty tags and nil skipOutput", func(t *testing.T) {
var settings SkipSettings
(&settings).ApplySettings("meta,success", nil)

if !settings.SkipMeta() {
t.Errorf("expected SkipMeta to be true")
}

if !settings.SkipSuccess() {
t.Errorf("expected SkipSuccess to be true")
}

if settings.SkipFailure() {
t.Errorf("expected SkipFailure to be false")
}
})
}

0 comments on commit 93d0d38

Please sign in to comment.