diff --git a/src/main/ipc/worktree-git-common-watch.test.ts b/src/main/ipc/worktree-git-common-watch.test.ts index e4c508e45..f067e3225 100644 --- a/src/main/ipc/worktree-git-common-watch.test.ts +++ b/src/main/ipc/worktree-git-common-watch.test.ts @@ -1,5 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { appendFile, mkdtemp, mkdir, realpath, rm, writeFile } from 'node:fs/promises' +import { rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { subscribeViaWatcherProcess } from './parcel-watcher-process' @@ -362,8 +363,11 @@ describe('worktree git-common polling gate (non-darwin)', () => { await new Promise((resolve) => setTimeout(resolve, POLL_MS * 2)) const worktreesDir = join(commonDir, 'worktrees') - await rm(worktreesDir, { recursive: true, force: true }) - await writeFile(worktreesDir, 'not-a-dir') + // Swap dir -> file synchronously so no event-loop turn (and thus no poll + // tick) observes the transient ENOENT window, which would legitimately emit + // a delete and defeat the non-ENOENT assertion below. + rmSync(worktreesDir, { recursive: true, force: true }) + writeFileSync(worktreesDir, 'not-a-dir') await new Promise((resolve) => setTimeout(resolve, POLL_MS * 4)) expect(received.flat()).not.toContainEqual({ type: 'delete', path: entry }) diff --git a/src/main/runtime/orca-runtime.test.ts b/src/main/runtime/orca-runtime.test.ts index 0a83a6e4a..e9f6698e4 100644 --- a/src/main/runtime/orca-runtime.test.ts +++ b/src/main/runtime/orca-runtime.test.ts @@ -36951,7 +36951,11 @@ describe('OrcaRuntimeService', () => { }) it('does not start Git removal when physical PTY stop cannot be proven', async () => { - const localProvider = createProviderStub(async () => []) + // A failed stop only rejects when a fresh inventory still shows the PTY + // live; keep pty-1 present so the exit cannot be proven. + const localProvider = createProviderStub(async () => [ + { id: 'pty-1', cwd: '/tmp', title: 'shell' } + ]) const runtime = new OrcaRuntimeService(store, undefined, { getLocalProvider: () => localProvider as never })