@@ -185,15 +185,33 @@ test('resolveTargetDevice selects the unique booted simulator with the requested
185185 ) ;
186186} ) ;
187187
188- test ( 'resolveTargetDevice reuses an app-aware selection for later request resolution' , async ( ) => {
188+ test ( 'resolveTargetDevice uses app-aware iOS selection when platform is omitted' , async ( ) => {
189+ mockListAppleDevices . mockResolvedValue ( [ bootedSimulator , secondBootedSimulator ] ) ;
190+ mockFindIosSimulatorInstalledApp . mockImplementation ( async ( device ) =>
191+ device . id === secondBootedSimulator . id ? 'com.example.demo' : undefined ,
192+ ) ;
193+
194+ const result = await resolveTargetDevice ( { } , { appleSimulatorAppTarget : 'com.example.demo' } ) ;
195+
196+ assert . equal ( result . id , secondBootedSimulator . id ) ;
197+ assert . deepEqual (
198+ mockFindIosSimulatorInstalledApp . mock . calls . map ( ( [ device , app ] ) => [ device . id , app ] ) ,
199+ [
200+ [ bootedSimulator . id , 'com.example.demo' ] ,
201+ [ secondBootedSimulator . id , 'com.example.demo' ] ,
202+ ] ,
203+ ) ;
204+ } ) ;
205+
206+ test ( 'resolveTargetDevice reuses an app-aware selection for later platform-inferred resolution' , async ( ) => {
189207 mockListAppleDevices . mockResolvedValue ( [ bootedSimulator , secondBootedSimulator ] ) ;
190208 mockFindIosSimulatorInstalledApp . mockImplementation ( async ( device ) =>
191209 device . id === secondBootedSimulator . id ? 'com.example.demo' : undefined ,
192210 ) ;
193211
194212 const [ appAware , laterResolution ] = await withResolveTargetDeviceCacheScope ( async ( ) => [
195- await resolveTargetDevice ( { platform : 'ios' } , { appleSimulatorAppTarget : 'com.example.demo' } ) ,
196- await resolveTargetDevice ( { platform : 'ios' } ) ,
213+ await resolveTargetDevice ( { } , { appleSimulatorAppTarget : 'com.example.demo' } ) ,
214+ await resolveTargetDevice ( { } ) ,
197215 ] ) ;
198216
199217 assert . equal ( appAware . id , secondBootedSimulator . id ) ;
@@ -233,11 +251,11 @@ test('resolveTargetDevice refuses ambiguous booted simulator app matches', async
233251 assert . equal ( error . details ?. hint , 'Pass --udid to select the intended simulator explicitly.' ) ;
234252} ) ;
235253
236- test ( 'resolveTargetDevice does not probe when an Apple device is explicitly selected ' , async ( ) => {
254+ test ( 'resolveTargetDevice preserves an explicit device selector when platform is omitted ' , async ( ) => {
237255 mockListAppleDevices . mockResolvedValue ( [ bootedSimulator , secondBootedSimulator ] ) ;
238256
239257 const result = await resolveTargetDevice (
240- { platform : 'ios' , udid : bootedSimulator . id } ,
258+ { udid : bootedSimulator . id } ,
241259 { appleSimulatorAppTarget : 'com.example.demo' } ,
242260 ) ;
243261
0 commit comments