Skip to content

Commit

Permalink
Add alternative unicode icons like go-test-report
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Sep 2, 2023
1 parent b543676 commit af05677
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Formats:
Format icons:
default the original unicode (✓, ∅, ✖)
alternative an alternative unicode (✓, ‐, ✗)
hivis higher visibility unicode (✅, ➖, ❌)
text simple text characters (PASS, SKIP, FAIL)
* nerdfonts requires a font from https://www.nerdfonts.com/
Expand Down
1 change: 1 addition & 0 deletions cmd/testdata/gotestsum-help-text
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Formats:

Format icons:
default the original unicode (✓, ∅, ✖)
alternative an alternative unicode (✓, ‐, ✗)
hivis higher visibility unicode (✅, ➖, ❌)
text simple text characters (PASS, SKIP, FAIL)
* nerdfonts requires a font from https://www.nerdfonts.com/
Expand Down
7 changes: 7 additions & 0 deletions testjson/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ func getIconFunc(opts FormatOptions) func(Action) string {
fail: "\U000f0c76", // md-emoticon_sad
color: true,
}.forAction
case opts.Icons == "alternative": // used in go-test-report
return icons{
pass: "✓", // CHECK MARK (✓)
skip: "‐", // HYPHEN (‐)
fail: "✗", // BALLOT X (✗)
color: true,
}.forAction
default:
return icons{
pass: "✓", // CHECK MARK
Expand Down
7 changes: 7 additions & 0 deletions testjson/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ func TestFormats_DefaultGoTestJson(t *testing.T) {
},
expectedOut: "format/pkgname.out",
},
{
name: "pkgname with alternative",
format: func(out io.Writer) EventFormatter {
return pkgNameFormat(out, FormatOptions{Icons: "alternative"})
},
expectedOut: "format/pkgname-alternative.out",
},
{
name: "pkgname with hivis",
format: func(out io.Writer) EventFormatter {
Expand Down
5 changes: 5 additions & 0 deletions testjson/testdata/format/pkgname-alternative.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
✗ testjson/internal/badmain (1ms)
‐ testjson/internal/empty (cached)
✓ testjson/internal/good (cached)
✗ testjson/internal/parallelfails (20ms)
✗ testjson/internal/withfails (20ms)

0 comments on commit af05677

Please sign in to comment.