test(lint): the skip notice is found behind CI's colour codes, red
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -125,3 +125,15 @@ func TestTaskLint_SkipsWithANoticeWhenGolangciLintIsAbsent(t *testing.T) {
|
|||||||
t.Fatalf("expected the skip notice; output:\n%s", out)
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user