Skip to content

Commit

Permalink
Prevent panic if flag.Parse hasn't been called (gavv#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-at-cybr authored Apr 26, 2023
1 parent ebb8d4d commit 2d6c5d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package httpexpect
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"math"
"net/http/httputil"
Expand Down Expand Up @@ -319,7 +320,7 @@ func (f *DefaultFormatter) fillGeneral(
case colorsForced:
data.EnableColors = true
case colorsSupported:
data.EnableColors = ctx.TestingTB && testing.Verbose()
data.EnableColors = ctx.TestingTB && flag.Parsed() && testing.Verbose()
}
case ColorModeAlways:
data.EnableColors = true
Expand Down

0 comments on commit 2d6c5d7

Please sign in to comment.