@@ -89,6 +89,7 @@ export async function runIosRunnerCommand(
8989 command : RunnerCommand ,
9090 options : { verbose ?: boolean ; logPath ?: string ; traceLogPath ?: string } = { } ,
9191) : Promise < Record < string , unknown > > {
92+ validateRunnerDevice ( device ) ;
9293 if ( isReadOnlyRunnerCommand ( command . command ) ) {
9394 return withRetry (
9495 ( ) => executeRunnerCommand ( device , command , options ) ,
@@ -232,7 +233,7 @@ async function ensureRunnerSession(
232233 'NO' ,
233234 '-test-timeouts-enabled' ,
234235 'NO' ,
235- '-maximum-concurrent-test- device-destinations' ,
236+ resolveRunnerMaxConcurrentDestinationsFlag ( device ) ,
236237 '1' ,
237238 '-xctestrun' ,
238239 xctestrunPath ,
@@ -319,7 +320,7 @@ async function ensureXctestrun(
319320 'AgentDeviceRunner' ,
320321 '-parallel-testing-enabled' ,
321322 'NO' ,
322- '-maximum-concurrent-test- device-destinations' ,
323+ resolveRunnerMaxConcurrentDestinationsFlag ( device ) ,
323324 '1' ,
324325 '-destination' ,
325326 resolveRunnerBuildDestination ( device ) ,
@@ -391,16 +392,31 @@ function ensureBootedIfNeeded(device: DeviceInfo): Promise<void> {
391392 return ensureBooted ( device . id ) ;
392393}
393394
395+ function validateRunnerDevice ( device : DeviceInfo ) : void {
396+ if ( device . platform !== 'ios' ) {
397+ throw new AppError ( 'UNSUPPORTED_PLATFORM' , `Unsupported platform for iOS runner: ${ device . platform } ` ) ;
398+ }
399+ if ( device . kind !== 'simulator' && device . kind !== 'device' ) {
400+ throw new AppError ( 'UNSUPPORTED_OPERATION' , `Unsupported iOS device kind for runner: ${ device . kind } ` ) ;
401+ }
402+ }
403+
404+ export function resolveRunnerMaxConcurrentDestinationsFlag ( device : DeviceInfo ) : string {
405+ return device . kind === 'device'
406+ ? '-maximum-concurrent-test-device-destinations'
407+ : '-maximum-concurrent-test-simulator-destinations' ;
408+ }
409+
394410export function resolveRunnerSigningBuildSettings (
395411 env : NodeJS . ProcessEnv = process . env ,
396412 forDevice = false ,
397413) : string [ ] {
414+ if ( ! forDevice ) {
415+ return [ ] ;
416+ }
398417 const teamId = env . AGENT_DEVICE_IOS_TEAM_ID ?. trim ( ) || '' ;
399418 const configuredIdentity = env . AGENT_DEVICE_IOS_SIGNING_IDENTITY ?. trim ( ) || '' ;
400419 const profile = env . AGENT_DEVICE_IOS_PROVISIONING_PROFILE ?. trim ( ) || '' ;
401- if ( ! forDevice && ! teamId && ! configuredIdentity && ! profile ) {
402- return [ ] ;
403- }
404420 const args = [ 'CODE_SIGN_STYLE=Automatic' ] ;
405421 if ( teamId ) {
406422 args . push ( `DEVELOPMENT_TEAM=${ teamId } ` ) ;
0 commit comments