fix: make test suite stable when NO_COLOR is set - #1449
Merged
mrexox merged 1 commit intoJun 19, 2026
Conversation
viralpraxis
commented
Jun 18, 2026
Member
mrexox
approved these changes
Jun 19, 2026
mrexox
left a comment
Member
There was a problem hiding this comment.
Thank you! I would appreciate a comment in loggertest.go explaining why we disable colors there.
```shell
$ env NO_COLOR=1 make test
go test -cpu 24 -race -count=1 -timeout=30s ./...
? github.com/evilmartians/lefthook/v2 [no test files]
? github.com/evilmartians/lefthook/v2/cmd [no test files]
? github.com/evilmartians/lefthook/v2/gen [no test files]
ok github.com/evilmartians/lefthook/v2/internal/command 1.081s
ok github.com/evilmartians/lefthook/v2/internal/config 1.050s
ok github.com/evilmartians/lefthook/v2/internal/git 1.018s
? github.com/evilmartians/lefthook/v2/internal/logger [no test files]
? github.com/evilmartians/lefthook/v2/internal/run [no test files]
--- FAIL: Test_guard_wrap (0.00s)
--- FAIL: Test_guard_wrap/stashUnstagedChanges=true_failOnChanges=true_with_partially_staged_and_hook_changes_with_diff (0.00s)
commander.go:122: 9) expected: 'git diff --color -- file1', called: 'git diff -- file1'
--- FAIL: Test_guard_wrap/failOnChanges=true_fail_with_changeset_different_with_diff (0.00s)
commander.go:122: 4) expected: 'git diff --color -- file1 file2', called: 'git diff -- file1 file2'
FAIL
FAIL github.com/evilmartians/lefthook/v2/internal/run/controller 0.039s
? github.com/evilmartians/lefthook/v2/internal/run/controller/command [no test files]
ok github.com/evilmartians/lefthook/v2/internal/run/controller/command/replacer 1.016s
ok github.com/evilmartians/lefthook/v2/internal/run/controller/exec 1.658s
ok github.com/evilmartians/lefthook/v2/internal/run/controller/filter 1.015s
ok github.com/evilmartians/lefthook/v2/internal/run/controller/utils 1.010s
ok github.com/evilmartians/lefthook/v2/internal/run/result 1.020s
ok github.com/evilmartians/lefthook/v2/internal/system 1.012s
? github.com/evilmartians/lefthook/v2/internal/templates [no test files]
ok github.com/evilmartians/lefthook/v2/internal/updater 1.028s
ok github.com/evilmartians/lefthook/v2/internal/version 1.016s
ok github.com/evilmartians/lefthook/v2/tests/helpers/cmdtest 1.014s
ok github.com/evilmartians/lefthook/v2/tests/helpers/configtest 1.016s
ok github.com/evilmartians/lefthook/v2/tests/helpers/gittest 1.017s
? github.com/evilmartians/lefthook/v2/tests/helpers/loggertest [no test files]
FAIL
make: *** [Makefile:25: test] Error 1
```
viralpraxis
force-pushed
the
make-tests-stable-with-no-color
branch
from
June 19, 2026 11:32
bde01d9 to
3b6170b
Compare
Member
Author
Done. |
NO_COLOR is setNO_COLOR is set
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.