feat: sort suites and tests alphabetically in the console summary

This commit is contained in:
technofab 2025-05-31 18:39:08 +02:00
parent f59d92791b
commit 7bb5c65259

View file

@ -2,8 +2,11 @@ package main
import (
"fmt"
"maps"
"os"
"regexp"
"slices"
"sort"
"strings"
"github.com/jedib0t/go-pretty/v6/table"
@ -67,7 +70,9 @@ func printSummary(results Results, successCount int, totalCount int) {
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)
suiteSuccess := 0
@ -83,6 +88,9 @@ func printSummary(results Results, successCount int, totalCount int) {
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 {
symbol := "❌"
if res.Status == StatusSuccess {