Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't write invalid characters in report files #482

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func newFailure(tc TestCase, stepNumber int, assertion string, err error) *Failu
var lineNumber = findLineNumber(tc.Classname, tc.originalName, stepNumber, assertion, -1)
var value string
if assertion != "" {
value = color.YellowString(`Testcase %q, step #%d: Assertion %q failed. %s (%v:%d)`,
value = fmt.Sprintf(`Testcase %q, step #%d: Assertion %q failed. %s (%v:%d)`,
tc.originalName,
stepNumber,
RemoveNotPrintableChar(assertion),
Expand All @@ -204,7 +204,7 @@ func newFailure(tc TestCase, stepNumber int, assertion string, err error) *Failu
lineNumber,
)
} else {
value = color.YellowString(`Testcase %q, step #%d: %s (%v:%d)`,
value = fmt.Sprintf(`Testcase %q, step #%d: %s (%v:%d)`,
tc.originalName,
stepNumber,
RemoveNotPrintableChar(err.Error()),
Expand All @@ -228,10 +228,10 @@ func newFailure(tc TestCase, stepNumber int, assertion string, err error) *Failu

func (f Failure) String() string {
if f.Value != "" {
return f.Value
return color.YellowString(f.Value)
}
if f.Error != nil {
return f.Error.Error()
return color.YellowString(f.Error.Error())
}
return f.Message
}
Expand Down
3 changes: 2 additions & 1 deletion venom_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (
)

func init() {
if strings.ToLower(os.Getenv("IS_TTY")) == "true" || os.Getenv("IS_TTY") == "1" {
color.NoColor = true
if os.Getenv("IS_TTY") == "" || strings.ToLower(os.Getenv("IS_TTY")) == "true" || os.Getenv("IS_TTY") == "1" {
color.NoColor = false
}
}
Expand Down