mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
test: disable colors on tests
This commit is contained in:
parent
9b0a75d24d
commit
0dbce75983
@ -7,19 +7,23 @@ import (
|
|||||||
"github.com/apex/log"
|
"github.com/apex/log"
|
||||||
"github.com/apex/log/handlers/cli"
|
"github.com/apex/log/handlers/cli"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
color.NoColor = true
|
||||||
|
}
|
||||||
|
|
||||||
func TestNotice(t *testing.T) {
|
func TestNotice(t *testing.T) {
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cli.Default.Writer = &out
|
cli.Default.Writer = &out
|
||||||
log.SetHandler(cli.Default)
|
log.SetHandler(cli.Default)
|
||||||
|
|
||||||
log.Info("first")
|
log.Info("first")
|
||||||
Notice("foo.bar.whatever")
|
Notice("foo.bar.whatever")
|
||||||
log.Info("last")
|
log.Info("last")
|
||||||
color.NoColor = true
|
|
||||||
|
|
||||||
assert.Contains(t, out.String(), " • first")
|
require.Contains(t, out.String(), " • first")
|
||||||
assert.Contains(t, out.String(), " • DEPRECATED: `foo.bar.whatever` should not be used anymore, check https://goreleaser.com/deprecations#foo-bar-whatever for more info.")
|
require.Contains(t, out.String(), " • DEPRECATED: `foo.bar.whatever` should not be used anymore, check https://goreleaser.com/deprecations#foo-bar-whatever for more info.")
|
||||||
assert.Contains(t, out.String(), " • last")
|
require.Contains(t, out.String(), " • last")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user