fix(diary): skip HideOnTTY records only on a terminal console, also with forced color (IN-01, quick-261028-rqd)

This commit is contained in:
Jakub Zych
2026-10-28 20:41:07 +01:00
parent f91d70d05e
commit 3520d5d480
8 changed files with 75 additions and 23 deletions

View File

@@ -357,8 +357,10 @@ func TestHideOnTTY(t *testing.T) {
blog := diary.For("blog")
blog.InfoContext(ctx, "hidden summary")
blog.Info("shown line")
if strings.Contains(styled.String(), "hidden summary") {
t.Errorf("styled console shows a HideOnTTY record:\n%s", styled.String())
// IN-01: forced color on a writer that is not a terminal keeps the
// HideOnTTY records; only a terminal console skips them.
if !strings.Contains(styled.String(), "hidden summary") {
t.Errorf("styled console off a terminal dropped a HideOnTTY record:\n%s", styled.String())
}
if !strings.Contains(styled.String(), "shown line") {
t.Errorf("styled console lacks the ordinary record:\n%s", styled.String())