MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveAppleDevice

Function resolveAppleDevice

src/core/dispatch-resolve.ts:62–80  ·  view source on GitHub ↗

* Resolves the best iOS device given pre-fetched candidates. When no explicit * device selector was used, physical devices are rejected in favour of a * bootable simulator discovered via `findBootableSimulator`. * * Exported for testing; production callers should use `resolveTargetDevice`.

(
  devices: DeviceInfo[],
  selector: AppleDeviceSelector,
  context: { simulatorSetPath?: string },
)

Source from the content-addressed store, hash-verified

60 * Exported for testing; production callers should use `resolveTargetDevice`.
61 */
62async function resolveAppleDevice(
63 devices: DeviceInfo[],
64 selector: AppleDeviceSelector,
65 context: { simulatorSetPath?: string },
66): Promise<DeviceInfo> {
67 const selected = await resolveAppleDeviceCandidate(devices, selector, context);
68
69 if (shouldUseAppleSimulatorFallback(selector, selected)) {
70 const { findBootableIosSimulator } = await import('../platforms/apple/core/devices.ts');
71 const simulator = await findBootableIosSimulator({
72 simulatorSetPath: context.simulatorSetPath,
73 target: selector.target,
74 });
75 if (simulator) return simulator;
76 }
77
78 if (selected) return selected;
79 throw new AppError('DEVICE_NOT_FOUND', 'No devices found', { selector });
80}
81
82async function resolveAppleDeviceCandidate(
83 devices: DeviceInfo[],

Callers 1

resolveTargetDeviceFunction · 0.85

Calls 3

findBootableIosSimulatorFunction · 0.85

Tested by

no test coverage detected