Skip to content

Commit 8cda4ef

Browse files
committed
ignore empty progress reports
1 parent 119f1d8 commit 8cda4ef

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

internal/progress_reporter_manager.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package internal
33
import (
44
"context"
55
"sort"
6+
"strings"
67
"sync"
78

89
"github.com/onsi/ginkgo/v2/types"
@@ -70,7 +71,9 @@ func (prm *ProgressReporterManager) QueryProgressReporters(ctx context.Context,
7071
case <-ctx.Done():
7172
return out
7273
}
73-
out = append(out, report)
74+
if strings.TrimSpace(report) != "" {
75+
out = append(out, report)
76+
}
7477
}
7578
return out
7679
}

internal/progress_reporter_manager_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ var _ = Describe("ProgressReporterManager", func() {
5454
Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked(startingGoroutines))
5555
})
5656

57+
It("ignores empty progress reports", func() {
58+
manager.AttachProgressReporter(func() string { return "A" })
59+
manager.AttachProgressReporter(func() string { return "" })
60+
manager.AttachProgressReporter(func() string { return " " })
61+
manager.AttachProgressReporter(func() string { return "C" })
62+
result := manager.QueryProgressReporters(context.Background(), nil)
63+
Ω(result).Should(Equal([]string{"A", "C"}))
64+
})
65+
5766
It("catches panics and reports them as failures", func() {
5867
manager.AttachProgressReporter(func() string {
5968
panic("bam")

0 commit comments

Comments
 (0)