Skip to content

Commit 6d55663

Browse files
committed
test(ios): pin the reinstall uninstall-tolerance branch through deployApp
The uninstall tolerate predicate and its lowercasing had no test driving createAppleAppDeploymentOperations, so removing either left the whole suite green. Add a reinstall test, for both a physical CoreDevice and a simulator, where uninstall exits non-zero with mixed-case stderr ("ERROR: App Not Installed"): deployApp must still resolve and the install request must have run.
1 parent 9b7d9dd commit 6d55663

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

‎packages/platform-apple/src/deployment/runtime.test.ts‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,53 @@ test('physical iOS uninstall failure surfaces the devicectl Developer Mode hint'
471471
expect(run.mock.calls.some(([request]) => request.args.includes('uninstall'))).toBe(true);
472472
});
473473

474+
test.each([
475+
[
476+
'physical iOS CoreDevice',
477+
appleDevice({ kind: 'device', iosPhysicalDeviceBackend: 'coredevice' }),
478+
],
479+
['iOS simulator', appleDevice()],
480+
] as const)(
481+
'reinstall tolerates an already-missing %s uninstall with mixed-case stderr and still installs',
482+
async (_name, device) => {
483+
const resolveAppBundleId = vi.fn(async () => 'com.example.app');
484+
const prepareArtifact = vi.fn(async () => ({
485+
installablePath: '/tmp/App.app',
486+
bundleId: 'com.example.app',
487+
appName: 'Example',
488+
cleanup: vi.fn(async () => {}),
489+
}));
490+
const executor = {
491+
prepareArtifact,
492+
resolveAppBundleId,
493+
withInvalidatedAppResolutionCache: withoutInvalidatingAppResolutionCache,
494+
} as AppleAppDeploymentExecutor;
495+
const run = xcrunLikeRun((request) => {
496+
if (request.args.includes('uninstall')) {
497+
return { stdout: '', stderr: 'ERROR: App Not Installed', exitCode: 1 };
498+
}
499+
return bootedSimulatorListResult(request);
500+
});
501+
const host = deploymentHost(executor, run);
502+
const operations = createAppleAppDeploymentOperations({
503+
host,
504+
device,
505+
signal: new AbortController().signal,
506+
});
507+
508+
await expect(
509+
operations.deployApp?.({
510+
app: 'com.example.app',
511+
appPath: '/tmp/App.app',
512+
replaceExisting: true,
513+
}),
514+
).resolves.toMatchObject({ bundleId: 'com.example.app' });
515+
516+
expect(run.mock.calls.some(([request]) => request.args.includes('uninstall'))).toBe(true);
517+
expect(run.mock.calls.some(([request]) => request.args.includes('install'))).toBe(true);
518+
},
519+
);
520+
474521
test('preserves Apple reinstall partial-failure ordering', async () => {
475522
const order: string[] = [];
476523
const resolveAppBundleId = vi.fn(async () => {

0 commit comments

Comments
 (0)