Skip to content

Commit

Permalink
Only use groups for test cases with output.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Aug 25, 2023
1 parent 10f00c8 commit 70249b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion .project/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ linters:
- deadcode
- depguard
- errcheck
- gocognit
- goconst
- gofmt
- goimports
Expand Down
10 changes: 8 additions & 2 deletions testjson/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,19 @@ func githubActionsFormat(out io.Writer) eventFormatterFunc {

// test case end event
if event.Test != "" && event.Action.IsTerminal() {
buf.WriteString("::group::")
if len(output[key]) > 0 {
buf.WriteString("::group::")
} else {
buf.WriteString(" ")
}
testNameFormatTestEvent(buf, event)

for _, item := range output[key] {
buf.WriteString(item)
}
buf.WriteString("\n::endgroup::\n")
if len(output[key]) > 0 {
buf.WriteString("\n::endgroup::\n")
}
delete(output, key)
return buf.Flush()
}
Expand Down
3 changes: 2 additions & 1 deletion testjson/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,6 @@ func isFramingLine(line string, testName string) bool {
strings.HasPrefix(line, "=== PAUSE Test") ||
strings.HasPrefix(line, "=== CONT Test") ||
strings.HasPrefix(line, "--- FAIL: "+testName+" ") ||
strings.HasPrefix(line, "--- SKIP: "+testName+" ")
strings.HasPrefix(line, "--- SKIP: "+testName+" ") ||
strings.HasPrefix(line, "--- PASS: "+testName+" ")
}

0 comments on commit 70249b4

Please sign in to comment.