Skip to content

Commit f334710

Browse files
committed
test(apple-runner): the close tests' redirect double carries both give-backs
The close-finalization and session-close tests arrived from `main` answering the device-set redirect with `{ release }`, which was the entire handle the day they were written. Disposal now asks the session for `releaseBestEffort`, so those tests failed the moment this branch met them: `session.simulatorSetRedirect?.releaseBestEffort is not a function`. The double is what is incomplete here, not the teardown; guarding the call for a handle that does not implement its own type would only teach the next caller to hand one over. Both files now take the handle from `runner-session-fixtures.ts`, the module their neighbours already use for it, and drop the per-file spy that only ever appeared in the setup. That the gap went unnoticed by typecheck is the untyped `vi.fn()` standing in for `acquireXcodebuildSimulatorSetRedirect`, which answers anything; every redirect double in the tree now references the shared handle, and the `{ release }` literals left are the type's own field and the object the owning module builds.
1 parent d055691 commit f334710

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎packages/platform-apple/src/runner/__tests__/runner-close-finalization.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
makeRunnerLease,
1515
runnerError,
1616
runnerResponse,
17+
redirectHandle,
1718
} from './runner-session-fixtures.ts';
1819
import { mkdtempForTestSync } from './tmp-dir.ts';
1920
import { bindAppleApplicationLifecycle } from '../../lifecycle.ts';
@@ -56,7 +57,6 @@ const {
5657
mockSignalPidsBestEffort,
5758
mockSignalProcessGroupBestEffort,
5859
mockWaitForRunner,
59-
mockRedirectRelease,
6060
} = vi.hoisted(() => ({
6161
mockAcquireXcodebuildSimulatorSetRedirect: vi.fn(),
6262
mockCleanupTempFile: vi.fn(),
@@ -76,7 +76,6 @@ const {
7676
mockSignalPidsBestEffort: vi.fn(),
7777
mockSignalProcessGroupBestEffort: vi.fn(),
7878
mockWaitForRunner: vi.fn(),
79-
mockRedirectRelease: vi.fn(),
8079
}));
8180

8281
const TEST_OWNER_START_TIME = 'fixed-test-owner-start-time';
@@ -169,7 +168,7 @@ beforeEach(async () => {
169168
});
170169
mockResolveExpectedRunnerCacheMetadata.mockReturnValue({ schemaVersion: 1 });
171170
mockResolveRunnerDerivedPath.mockReturnValue('/tmp/derived');
172-
mockAcquireXcodebuildSimulatorSetRedirect.mockResolvedValue({ release: mockRedirectRelease });
171+
mockAcquireXcodebuildSimulatorSetRedirect.mockResolvedValue(redirectHandle);
173172
mockRunCmdBackground.mockReturnValue(makeBackgroundRunner(4242));
174173
mockRunAppleToolCommand.mockResolvedValue({ exitCode: 0, stdout: '', stderr: '' });
175174
mockIsProcessAlive.mockReturnValue(true);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
makeRunnerSession,
99
runnerError,
1010
runnerResponse,
11+
redirectHandle,
1112
} from './runner-session-fixtures.ts';
1213
import { mkdtempForTestSync } from './tmp-dir.ts';
1314

@@ -35,7 +36,6 @@ const {
3536
mockSignalPidsBestEffort,
3637
mockSignalProcessGroupBestEffort,
3738
mockWaitForRunner,
38-
mockRedirectRelease,
3939
} = vi.hoisted(() => ({
4040
mockAcquireXcodebuildSimulatorSetRedirect: vi.fn(),
4141
mockCleanupTempFile: vi.fn(),
@@ -55,7 +55,6 @@ const {
5555
mockSignalPidsBestEffort: vi.fn(),
5656
mockSignalProcessGroupBestEffort: vi.fn(),
5757
mockWaitForRunner: vi.fn(),
58-
mockRedirectRelease: vi.fn(),
5958
}));
6059

6160
const TEST_OWNER_START_TIME = 'fixed-test-owner-start-time';
@@ -152,7 +151,7 @@ beforeEach(async () => {
152151
});
153152
mockResolveExpectedRunnerCacheMetadata.mockReturnValue({ schemaVersion: 1 });
154153
mockResolveRunnerDerivedPath.mockReturnValue('/tmp/derived');
155-
mockAcquireXcodebuildSimulatorSetRedirect.mockResolvedValue({ release: mockRedirectRelease });
154+
mockAcquireXcodebuildSimulatorSetRedirect.mockResolvedValue(redirectHandle);
156155
mockRunCmdBackground.mockReturnValue(makeBackgroundRunner(4242));
157156
mockRunAppleToolCommand.mockResolvedValue({ exitCode: 0, stdout: '', stderr: '' });
158157
mockIsProcessAlive.mockReturnValue(true);

0 commit comments

Comments
 (0)