From 5baffd0189a220d94369898814e283905dc6a4c7 Mon Sep 17 00:00:00 2001 From: Mathias Date: Sat, 3 Oct 2026 21:18:05 +0200 Subject: [PATCH] fix(test): strip colour codes before looking for the lint skip notice (CI run 8937) Co-Authored-By: Claude Sonnet 5.5 --- test/lintgate/lintgate_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/lintgate/lintgate_test.go b/test/lintgate/lintgate_test.go index 279f463..78560ff 100644 --- a/test/lintgate/lintgate_test.go +++ b/test/lintgate/lintgate_test.go @@ -10,6 +10,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strings" "testing" ) @@ -40,10 +41,13 @@ func scratchModule(t *testing.T) string { return dir } +// ansi matches the colour escape sequences task prints when it thinks it has a terminal. +var ansi = regexp.MustCompile("\x1b\\[[0-9;]*m") + // hasSkipNotice reports whether the skip notice was printed as output. Task echoes the command // line first, and that line contains the same words, so a substring match would be vacuous. func hasSkipNotice(out string) bool { - for _, line := range strings.Split(out, "\n") { + for _, line := range strings.Split(ansi.ReplaceAllString(out, ""), "\n") { if strings.HasPrefix(line, "golangci-lint not installed") { return true }