Skip to content

Commit

Permalink
ignore empty progress reports
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed Mar 3, 2023
1 parent 119f1d8 commit 8cda4ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/progress_reporter_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package internal
import (
"context"
"sort"
"strings"
"sync"

"github.com/onsi/ginkgo/v2/types"
Expand Down Expand Up @@ -70,7 +71,9 @@ func (prm *ProgressReporterManager) QueryProgressReporters(ctx context.Context,
case <-ctx.Done():
return out
}
out = append(out, report)
if strings.TrimSpace(report) != "" {
out = append(out, report)
}
}
return out
}
9 changes: 9 additions & 0 deletions internal/progress_reporter_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ var _ = Describe("ProgressReporterManager", func() {
Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked(startingGoroutines))
})

It("ignores empty progress reports", func() {
manager.AttachProgressReporter(func() string { return "A" })
manager.AttachProgressReporter(func() string { return "" })
manager.AttachProgressReporter(func() string { return " " })
manager.AttachProgressReporter(func() string { return "C" })
result := manager.QueryProgressReporters(context.Background(), nil)
Ω(result).Should(Equal([]string{"A", "C"}))
})

It("catches panics and reports them as failures", func() {
manager.AttachProgressReporter(func() string {
panic("bam")
Expand Down

0 comments on commit 8cda4ef

Please sign in to comment.