diff --git a/test/lintgate/lintgate_test.go b/test/lintgate/lintgate_test.go index a971f61..279f463 100644 --- a/test/lintgate/lintgate_test.go +++ b/test/lintgate/lintgate_test.go @@ -125,3 +125,15 @@ func TestTaskLint_SkipsWithANoticeWhenGolangciLintIsAbsent(t *testing.T) { t.Fatalf("expected the skip notice; output:\n%s", out) } } + +// CI runs task with colour on, so the notice line starts with an escape sequence; a bare +// prefix match missed it there while passing on a terminal-less local run. +func TestHasSkipNotice_SeesTheNoticeBehindColourCodes(t *testing.T) { + out := "\x1b[32mtask: [lint] ...\n\x1b[0mgolangci-lint not installed — skipping (CI installs it)\n" + if !hasSkipNotice(out) { + t.Fatalf("notice not found in coloured output: %q", out) + } + if hasSkipNotice("\x1b[32mtask: [lint] if command -v golangci-lint ...; echo \"golangci-lint not installed\"\n") { + t.Fatal("the echoed command line must not count as the notice") + } +}