From 74823d2117b418122299b4799c10f66f8e94bc1c Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Tue, 11 Aug 2026 00:55:07 -0700 Subject: [PATCH] test: file-level 30s timeout for the three spawn-heavy CLI suites cli-json-daily, spend-flow and cli-emitters spawn the real CLI per test and blow the 5s default under full parallel suite load while passing in isolation - the flake set #948 documented on unmodified main, observed again locally (cli-json-daily) and in CI (cli-emitters on a green PR). Same file-level remedy the CLI menubar suite already uses; the default stays 5s for everything else. --- tests/cli-emitters.test.ts | 9 ++++++++- tests/cli-json-daily.test.ts | 9 ++++++++- tests/spend-flow.test.ts | 7 +++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/cli-emitters.test.ts b/tests/cli-emitters.test.ts index 6ef862ed..fa1a704a 100644 --- a/tests/cli-emitters.test.ts +++ b/tests/cli-emitters.test.ts @@ -3,7 +3,14 @@ import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' + +// These specs spawn the real CLI (tsx compile + full parse) per test, which +// blows the 5s default under full parallel suite load while passing cleanly +// in isolation — the exact flake class #948 documented and CI has hit +// (cli-emitters timed out on a green PR). Same file-level remedy as +// cli-status-menubar.test.ts: a 30s ceiling for spawn-heavy suites only. +vi.setConfig({ testTimeout: 30_000 }) function runCli(args: string[], home: string) { return spawnSync(process.execPath, ['--import', 'tsx', 'src/cli.ts', ...args], { diff --git a/tests/cli-json-daily.test.ts b/tests/cli-json-daily.test.ts index 193ee90d..0bb517b7 100644 --- a/tests/cli-json-daily.test.ts +++ b/tests/cli-json-daily.test.ts @@ -3,7 +3,14 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { spawnSync } from 'node:child_process' -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' + +// These specs spawn the real CLI (tsx compile + full parse) per test, which +// blows the 5s default under full parallel suite load while passing cleanly +// in isolation — the exact flake class #948 documented and CI has hit +// (cli-emitters timed out on a green PR). Same file-level remedy as +// cli-status-menubar.test.ts: a 30s ceiling for spawn-heavy suites only. +vi.setConfig({ testTimeout: 30_000 }) function runCli(args: string[], home: string) { return spawnSync(process.execPath, ['--import', 'tsx', 'src/cli.ts', ...args], { diff --git a/tests/spend-flow.test.ts b/tests/spend-flow.test.ts index 5f031e20..6108092c 100644 --- a/tests/spend-flow.test.ts +++ b/tests/spend-flow.test.ts @@ -7,6 +7,13 @@ import { describe, expect, it, vi } from 'vitest' import type { DateRange, ProjectSummary, SessionSummary, TokenUsage } from '../src/types.js' +// These specs spawn the real CLI (tsx compile + full parse) per test, which +// blows the 5s default under full parallel suite load while passing cleanly +// in isolation — the exact flake class #948 documented and CI has hit +// (cli-emitters timed out on a green PR). Same file-level remedy as +// cli-status-menubar.test.ts: a 30s ceiling for spawn-heavy suites only. +vi.setConfig({ testTimeout: 30_000 }) + const parserMock = vi.hoisted(() => ({ parseAllSessions: vi.fn(), }))