@@ -95,10 +95,12 @@ async function openRelaunch(params: {
9595 onOpenApplication ?: ( input : OpenApplicationInput ) => Promise < void > | void ;
9696} ) {
9797 const opened : OpenApplicationInput [ ] = [ ] ;
98+ const boundDevices : DeviceInfo [ ] = [ ] ;
9899 const bindDevice : Parameters < typeof handleSessionCommands > [ 0 ] [ 'bindDevice' ] = async (
99100 device ,
100101 use ,
101102 ) => {
103+ boundDevices . push ( device ) ;
102104 const binding = await mockBindDeviceRuntime ( device , use ) ;
103105 return {
104106 ...binding ,
@@ -128,7 +130,7 @@ async function openRelaunch(params: {
128130 invoke : noopInvoke ,
129131 bindDevice,
130132 } ) ;
131- return { response, opened } ;
133+ return { response, opened, boundDevices } ;
132134}
133135
134136test ( 'open --relaunch asks the lifecycle to relaunch the active session app' , async ( ) => {
@@ -179,29 +181,31 @@ test('open --relaunch does not let an ambient provider claim suppress the relaun
179181 installProviderDeviceAdmission ( { isActive : ( device ) => device . id === ANDROID_EMULATOR . id } ) ;
180182 mockResolveTargetDevice . mockResolvedValue ( ANDROID_EMULATOR ) ;
181183
182- const { response, opened } = await openRelaunch ( {
184+ const { response, opened, boundDevices } = await openRelaunch ( {
183185 sessionStore,
184186 sessionName : 'provider-android-session' ,
185187 positionals : [ 'com.example.app' ] ,
186188 flags : { platform : 'android' } ,
187189 } ) ;
188190
189191 expect ( response ?. ok ) . toBe ( true ) ;
192+ expect ( boundDevices ) . toEqual ( [ ANDROID_EMULATOR ] ) ;
190193 expect ( opened ) . toEqual ( [ expect . objectContaining ( { relaunch : true , hasExistingSession : false } ) ] ) ;
191194} ) ;
192195
193196test ( 'open --relaunch without a session relaunches the requested app on the resolved device' , async ( ) => {
194197 const sessionStore = makeSessionStore ( ) ;
195198 mockResolveTargetDevice . mockResolvedValue ( IOS_DEVICE ) ;
196199
197- const { response, opened } = await openRelaunch ( {
200+ const { response, opened, boundDevices } = await openRelaunch ( {
198201 sessionStore,
199202 sessionName : 'ios-new-session' ,
200203 positionals : [ 'com.example.app' ] ,
201204 flags : { platform : 'ios' } ,
202205 } ) ;
203206
204207 expect ( response ?. ok ) . toBe ( true ) ;
208+ expect ( boundDevices ) . toEqual ( [ IOS_DEVICE ] ) ;
205209 expect ( opened ) . toEqual ( [
206210 expect . objectContaining ( {
207211 relaunch : true ,
0 commit comments