From 0dbce759839a0d7c2433f31c6974408cfa6254d3 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sat, 27 Oct 2018 12:59:42 -0300 Subject: [PATCH] test: disable colors on tests --- internal/deprecate/deprecate_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/deprecate/deprecate_test.go b/internal/deprecate/deprecate_test.go index 481e9ae7a..21faa3e36 100644 --- a/internal/deprecate/deprecate_test.go +++ b/internal/deprecate/deprecate_test.go @@ -7,19 +7,23 @@ import ( "github.com/apex/log" "github.com/apex/log/handlers/cli" "github.com/fatih/color" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) +func init() { + color.NoColor = true +} + func TestNotice(t *testing.T) { var out bytes.Buffer cli.Default.Writer = &out log.SetHandler(cli.Default) + log.Info("first") Notice("foo.bar.whatever") log.Info("last") - color.NoColor = true - assert.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.") - assert.Contains(t, out.String(), " • last") + require.Contains(t, out.String(), " • first") + 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.") + require.Contains(t, out.String(), " • last") }