Skip to content

Commit 600ef52

Browse files
committed
test(sidebar): give github/star route tests room for gh timeouts
Windows CI flakes when Bun's default 5s test budget races star-state's 5s auth kill on a slow credential helper. Raise only these two route tests to cover AUTH+API budgets.
1 parent 4f0633f commit 600ef52

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/sidebar-routes.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ describe("GET /api/update/badge", () => {
5151
});
5252

5353
describe("GET /api/github/star", () => {
54+
// These hit a real `gh` spawn (auth then api). AUTH_TIMEOUT_MS is 5s and API_TIMEOUT_MS
55+
// is 10s in star-state.ts — Bun's default 5s test budget races the auth kill on a slow
56+
// Windows credential helper and flakes as a timeout even when spawnGh is correct.
57+
const STAR_ROUTE_TIMEOUT_MS = 20_000;
58+
5459
test("is routed and reports one of the three known states", async () => {
5560
invalidateStarStatusCache();
5661
const { status, body } = await call("GET", "/api/github/star");
@@ -59,7 +64,7 @@ describe("GET /api/github/star", () => {
5964
expect(["starred", "not-starred", "unauthenticated"]).toContain(star.state);
6065
expect(star.repo).toBe("lidge-jun/opencodex");
6166
expect(star.url).toBe("https://github.com/lidge-jun/opencodex");
62-
});
67+
}, { timeout: STAR_ROUTE_TIMEOUT_MS });
6368

6469
test("never serializes gh output, tokens, or account identifiers", async () => {
6570
invalidateStarStatusCache();
@@ -71,7 +76,7 @@ describe("GET /api/github/star", () => {
7176
expect(raw.toLowerCase()).not.toContain("scope");
7277
expect(raw).not.toContain("gho_");
7378
expect(raw).not.toContain("ghp_");
74-
});
79+
}, { timeout: STAR_ROUTE_TIMEOUT_MS });
7580
});
7681

7782
describe("route surface", () => {

0 commit comments

Comments
 (0)