Skip to content

Commit

Permalink
Fail with verbose and json options (#129)
Browse files Browse the repository at this point in the history
* Fail with verbose and json options

* Bump version
  • Loading branch information
raviqqe authored Oct 24, 2020
1 parent 89244aa commit a61cb11
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .snapshots/TestCommandFailWithVerboseAndJSONOptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
verbose option not supported for JSON output

2 changes: 2 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func (c *command) runWithError(ss []string) (bool, error) {
} else if args.Version {
c.print(version)
return err == nil, err
} else if args.JSONOutput && args.Verbose {
return false, errors.New("verbose option not supported for JSON output")
}

client := newThrottledHTTPClient(
Expand Down
11 changes: 11 additions & 0 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,14 @@ func TestCommandDoNotIncludeSuccessfulPageInJSONOutput(t *testing.T) {
assert.True(t, ok)
assert.Equal(t, strings.TrimSpace(b.String()), "[]")
}

func TestCommandFailWithVerboseAndJSONOptions(t *testing.T) {
b := &bytes.Buffer{}

ok := newTestCommandWithStderr(b, nil).Run(
[]string{"--json", "--verbose", "http://foo.com"},
)

assert.False(t, ok)
cupaloy.SnapshotT(t, b.String())
}
2 changes: 1 addition & 1 deletion configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import "time"

const (
version = "2.2.1"
version = "2.2.2"
agentName = "muffet"
concurrency = 1024
tcpTimeout = 5 * time.Second
Expand Down

0 comments on commit a61cb11

Please sign in to comment.