diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efb8438..489eb09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: test: name: Test & build - runs-on: macos-14 + runs-on: macos-latest steps: - uses: actions/checkout@v5 diff --git a/tests/cli/resume.test.ts b/tests/cli/resume.test.ts index 29d4e5d..336567e 100644 --- a/tests/cli/resume.test.ts +++ b/tests/cli/resume.test.ts @@ -48,7 +48,12 @@ describe('resume', () => { it('spawns claude with --resume and --permission-mode auto by default', () => { const spawn = vi.fn(() => ({ status: 0, error: undefined })) as never; const exit = vi.fn(); - resume(record(), {}, { exists: () => true, spawn, exit: exit as never, permissionMode: () => 'auto' }); + vi.stubEnv('AGENTCTL_CLAUDE_BIN', undefined); // a shell that exports an override would change the bin + try { + resume(record(), {}, { exists: () => true, spawn, exit: exit as never, permissionMode: () => 'auto' }); + } finally { + vi.unstubAllEnvs(); + } expect(spawn).toHaveBeenCalledOnce(); const call = (spawn as unknown as { mock: { calls: unknown[][] } }).mock.calls[0]; expect(call[0]).toBe('claude'); diff --git a/tests/cli/tui.test.tsx b/tests/cli/tui.test.tsx index 93eb883..4c7cf11 100644 --- a/tests/cli/tui.test.tsx +++ b/tests/cli/tui.test.tsx @@ -4,6 +4,10 @@ import { render } from 'ink-testing-library'; import { App } from '../../src/cli/tui.js'; import type { SessionRecord } from '../../src/core/types.js'; +/** One timestamp for every record: the TUI sorts newest-first, so a per-record `new Date()` that + * crosses a millisecond tick mid-build reorders the list and flakes order-dependent tests. */ +const NOW = new Date(); + function rec(id: string, name: string): SessionRecord { return { id, name, transcriptName: name, cwd: '/tmp', launchCwd: '/tmp', @@ -11,8 +15,8 @@ function rec(id: string, name: string): SessionRecord { kind: 'interactive' as const, jsonlPath: '/x.jsonl', sizeBytes: 0, - startedAt: new Date(), - lastUpdatedAt: new Date(), + startedAt: NOW, + lastUpdatedAt: NOW, active: false, status: 'inactive', };