Skip to content

Commit bc68c7e

Browse files
committed
test: stub runner operations in the replay test-runner suite and keep runner-session tests within the size ratchet
A Simulator open schedules a best-effort runner prewarm that outlives its request. The replay test-runner suite opened a Simulator with the real Apple tools, so the prewarm's deferred import resolved after the file finished and spawned into whichever file the worker ran next, where the hermetic signal guard failed an unrelated test.
1 parent ff0b58d commit bc68c7e

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

packages/platform-apple/src/runner/__tests__/runner-session.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,8 @@ test('runner session starts xcodebuild through provider seams and reuses an aliv
666666
mockRunXcrun.mock.calls.some((call) => call[0]?.includes('uninstall')),
667667
false,
668668
);
669-
assert.deepEqual(getRunnerSessionSnapshot(device.id), {
670-
sessionId: session.sessionId,
671-
alive: true,
672-
ready: session.ready,
673-
});
669+
const expected = { sessionId: session.sessionId, alive: true, ready: false };
670+
assert.deepEqual(getRunnerSessionSnapshot(device.id), expected);
674671
});
675672

676673
test('runner session emits XCTest startup progress only after a runner rebuild', async () => {

src/daemon/replay/internal/__tests__/session-test-runner.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ import type { DaemonRequest } from '../../../types.ts';
1414
import { handleSessionCommands } from '../../../handlers/__tests__/session-command-harness.ts';
1515
import { mkdtempForTestSync } from '../../../../__tests__/test-utils/tmp-dir.ts';
1616

17+
// Opening a Simulator schedules a best-effort runner prewarm that outlives the request; a real one
18+
// would spawn xcodebuild after this file finished and land in whichever file the worker runs next.
19+
vi.mock('@agent-device/platform-apple/runner/operations', async (importOriginal) => {
20+
const actual =
21+
await importOriginal<typeof import('@agent-device/platform-apple/runner/operations')>();
22+
return {
23+
...actual,
24+
prewarmAppleRunnerCache: vi.fn(),
25+
prewarmIosRunnerSession: vi.fn(),
26+
notifyIosRunnerAppRelaunched: vi.fn(async () => {}),
27+
hasLiveIosRunnerSession: vi.fn(() => false),
28+
scheduleIosRunnerIdleStop: vi.fn(),
29+
stopIosRunnerSession: vi.fn(async () => {}),
30+
};
31+
});
32+
1733
test('session_list includes device_udid and ios_simulator_device_set for iOS sessions', async () => {
1834
const sessionStore = makeSessionStore();
1935
sessionStore.set(

0 commit comments

Comments
 (0)