diff --git a/cmd/root.go b/cmd/root.go index a16f558da12..efbe2251f35 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -174,11 +174,6 @@ func rootCmdPersistentFlagSet(gs *state.GlobalState) *pflag.FlagSet { "change the output for k6 logs, possible values are stderr,stdout,none,loki[=host:port],file[=./path.fileformat]") flags.Lookup("log-output").DefValue = gs.DefaultFlags.LogOutput - flags.StringVar(&gs.Flags.LogFormat, "logformat", gs.Flags.LogFormat, "log output format") - oldLogFormat := flags.Lookup("logformat") - oldLogFormat.Hidden = true - oldLogFormat.Deprecated = "log-format" - oldLogFormat.DefValue = gs.DefaultFlags.LogFormat flags.StringVar(&gs.Flags.LogFormat, "log-format", gs.Flags.LogFormat, "log output format") flags.Lookup("log-format").DefValue = gs.DefaultFlags.LogFormat diff --git a/cmd/root_test.go b/cmd/root_test.go index d1ccf9f54a7..b09b4acd0d2 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -1,7 +1,6 @@ package cmd import ( - "bytes" "testing" "github.com/sirupsen/logrus" @@ -16,30 +15,6 @@ func TestMain(m *testing.M) { tests.Main(m) } -func TestDeprecatedOptionWarning(t *testing.T) { - t.Parallel() - - ts := tests.NewGlobalTestState(t) - ts.CmdArgs = []string{"k6", "--logformat", "json", "run", "-"} - ts.Stdin = bytes.NewBuffer([]byte(` - console.log('foo'); - export default function() { console.log('bar'); }; - `)) - - newRootCommand(ts.GlobalState).execute() - - logMsgs := ts.LoggerHook.Drain() - assert.True(t, testutils.LogContains(logMsgs, logrus.InfoLevel, "foo")) - assert.True(t, testutils.LogContains(logMsgs, logrus.InfoLevel, "bar")) - assert.Contains(t, ts.Stderr.String(), `"level":"info","msg":"foo","source":"console"`) - assert.Contains(t, ts.Stderr.String(), `"level":"info","msg":"bar","source":"console"`) - - // TODO: after we get rid of cobra, actually emit this message to stderr - // and, ideally, through the log, not just print it... - assert.False(t, testutils.LogContains(logMsgs, logrus.InfoLevel, "logformat")) - assert.Contains(t, ts.Stdout.String(), `--logformat has been deprecated`) -} - func TestPanicHandling(t *testing.T) { t.Parallel()