Skip to content

Commit

Permalink
feat: handler IS_TTY env variable to display color (#322)
Browse files Browse the repository at this point in the history
* feat: handler IS_TTY env variable to display color

Signed-off-by: francois  samin <[email protected]>
  • Loading branch information
fsamin authored Nov 20, 2020
1 parent 7b1a450 commit 3825176
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ $ venom run test.yml
[info] the value of result.systemoutjson is map[foo:bar] (exec.yml:34)
```

# Use venom in CI

Venom can be use on dev environement or your CI server.
To display correctly the venom output, you probably will have to export the environment variable `IS_TTY=true` before running venom.

# Hacking

Expand Down
9 changes: 9 additions & 0 deletions venom_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"time"

"github.com/fatih/color"
tap "github.com/mndrix/tap-go"
log "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v2"
)

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

// OutputResult output result to sdtout, files...
func (v *Venom) OutputResult(tests Tests, elapsed time.Duration) error {
if v.OutputDir == "" {
Expand Down

0 comments on commit 3825176

Please sign in to comment.