Tests that exercise error paths in errLog/warn were causing GitHub Actions to annotate test output with 'Error: R] ...' (GHA eats '[ERRO' from '[ERROR]' lines and surfaces the rest as workflow errors), making real failures hard to distinguish from expected behavior. - issues.go: route logIssue output through issueLogWriter (io.Writer, defaults to os.Stdout). errorCount/issues/notices recording is unchanged so tests still assert via errorCount. - testmain_test.go: TestMain sets issueLogWriter = io.Discard for the whole test binary. - issues_test.go: TestIssuesLogging temporarily redirects issueLogWriter to a bytes.Buffer (replacing os.Pipe stdout capture). go test -v ./... now contains zero stray '[ERROR]' lines; real test failures remain visible and 'go test' still exits non-zero on failure, failing the workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
17 lines
406 B
Go
17 lines
406 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// TestMain silences issue-log output for the entire test binary.
|
|
// Tests still exercise error paths and assert via errorCount; we just
|
|
// don't want the human-facing "[ERROR] ..." prints polluting CI logs
|
|
// (GitHub Actions auto-annotates "[ERROR]" lines as workflow errors).
|
|
func TestMain(m *testing.M) {
|
|
issueLogWriter = io.Discard
|
|
os.Exit(m.Run())
|
|
}
|