* 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 },
)
| 60 | * Exported for testing; production callers should use `resolveTargetDevice`. |
| 61 | */ |
| 62 | async 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 | |
| 82 | async function resolveAppleDeviceCandidate( |
| 83 | devices: DeviceInfo[], |
no test coverage detected