mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 10:10:09 +01:00
feat: sort suites and tests alphabetically in the console summary
This commit is contained in:
parent
f59d92791b
commit
7bb5c65259
1 changed files with 9 additions and 1 deletions
|
|
@ -2,8 +2,11 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jedib0t/go-pretty/v6/table"
|
"github.com/jedib0t/go-pretty/v6/table"
|
||||||
|
|
@ -67,7 +70,9 @@ func printSummary(results Results, successCount int, totalCount int) {
|
||||||
|
|
||||||
log.Info().Msg("Summary:")
|
log.Info().Msg("Summary:")
|
||||||
|
|
||||||
for suite, suiteResults := range results {
|
suitesSorted := slices.Sorted(maps.Keys(results))
|
||||||
|
for _, suite := range suitesSorted {
|
||||||
|
suiteResults := results[suite]
|
||||||
suiteTotal := len(suiteResults)
|
suiteTotal := len(suiteResults)
|
||||||
suiteSuccess := 0
|
suiteSuccess := 0
|
||||||
|
|
||||||
|
|
@ -83,6 +88,9 @@ func printSummary(results Results, successCount int, totalCount int) {
|
||||||
fmt.Sprintf("%d/%d", suiteSuccess, suiteTotal),
|
fmt.Sprintf("%d/%d", suiteSuccess, suiteTotal),
|
||||||
"",
|
"",
|
||||||
})
|
})
|
||||||
|
sort.Slice(suiteResults, func(i, j int) bool {
|
||||||
|
return suiteResults[i].Spec.Name < suiteResults[j].Spec.Name
|
||||||
|
})
|
||||||
for _, res := range suiteResults {
|
for _, res := range suiteResults {
|
||||||
symbol := "❌"
|
symbol := "❌"
|
||||||
if res.Status == StatusSuccess {
|
if res.Status == StatusSuccess {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue