Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle LEFTHOOK_QUIET when there is no skip_output in config #630

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we extend the previous test to include tags variable? I think we can add a testcase with tags: "meta,success" and settings: nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

}
Loading