Skip to content

test(printer): isolate color environment and verify opt-out - #39

Open
rupayon123 wants to merge 1 commit into
kavix:mainfrom
rupayon123:contribution/hermetic-color-tests-20260913
Open

test(printer): isolate color environment and verify opt-out#39
rupayon123 wants to merge 1 commit into
kavix:mainfrom
rupayon123:contribution/hermetic-color-tests-20260913

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

Color-output tests fail when a contributor runs the suite from a shell with NO_COLOR=1, even though suppressing color is the intended behavior.

Give the two ANSI assertions their own empty NO_COLOR setting using t.Setenv, and add JSON/HTML tests proving a nonempty NO_COLOR suppresses ANSI even when formatting requests color. Product behavior is unchanged, and the environment is restored automatically after each test.

Validation: reproduced both original failures with NO_COLOR=1 go test ./printer -count=1. Afterward the full suite passes with NO_COLOR=1, printer tests also pass with the variable unset, and go vet ./..., build and diff checks pass. golangci-lint is unavailable locally; remote CI will be checked separately. Prepared with AI assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant