Skip to content

Commit 36063ab

Browse files
authored
Merge pull request #62 from tstromberg/windows
Show 'tests running' as a state
2 parents 1f87c31 + 3517993 commit 36063ab

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

cmd/goose/main_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"runtime"
8+
"strings"
89
"sync"
910
"testing"
1011
"time"
@@ -110,6 +111,17 @@ func TestMenuItemTitleTransition(t *testing.T) {
110111
// This simulates what addPRSection does when building menu items
111112
for _, pr := range app.incoming {
112113
title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number)
114+
115+
// Add action code if present, or test state as fallback
116+
if pr.ActionKind != "" {
117+
// Replace underscores with spaces for better readability
118+
actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ")
119+
title = fmt.Sprintf("%s — %s", title, actionDisplay)
120+
} else if pr.TestState == "running" {
121+
// Show "tests running" as a fallback when no specific action is available
122+
title = fmt.Sprintf("%s — tests running...", title)
123+
}
124+
113125
if pr.NeedsReview {
114126
if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration {
115127
title = fmt.Sprintf("🪿 %s", title)
@@ -122,6 +134,17 @@ func TestMenuItemTitleTransition(t *testing.T) {
122134

123135
for _, pr := range app.outgoing {
124136
title := fmt.Sprintf("%s #%d", pr.Repository, pr.Number)
137+
138+
// Add action code if present, or test state as fallback
139+
if pr.ActionKind != "" {
140+
// Replace underscores with spaces for better readability
141+
actionDisplay := strings.ReplaceAll(pr.ActionKind, "_", " ")
142+
title = fmt.Sprintf("%s — %s", title, actionDisplay)
143+
} else if pr.TestState == "running" {
144+
// Show "tests running" as a fallback when no specific action is available
145+
title = fmt.Sprintf("%s — tests running...", title)
146+
}
147+
125148
if pr.IsBlocked {
126149
if !pr.FirstBlockedAt.IsZero() && time.Since(pr.FirstBlockedAt) < testBlockDuration {
127150
title = fmt.Sprintf("🎉 %s", title)

cmd/goose/ui.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,14 @@ func (app *App) addPRSection(ctx context.Context, prs []PR, sectionTitle string,
308308

309309
title := fmt.Sprintf("%s #%d", sortedPRs[prIndex].Repository, sortedPRs[prIndex].Number)
310310

311-
// Add action code if present
311+
// Add action code if present, or test state as fallback
312312
if sortedPRs[prIndex].ActionKind != "" {
313-
title = fmt.Sprintf("%s — %s", title, sortedPRs[prIndex].ActionKind)
313+
// Replace underscores with spaces for better readability
314+
actionDisplay := strings.ReplaceAll(sortedPRs[prIndex].ActionKind, "_", " ")
315+
title = fmt.Sprintf("%s — %s", title, actionDisplay)
316+
} else if sortedPRs[prIndex].TestState == "running" {
317+
// Show "tests running" as a fallback when no specific action is available
318+
title = fmt.Sprintf("%s — tests running...", title)
314319
}
315320

316321
// Add bullet point or emoji based on PR status

0 commit comments

Comments
 (0)