@@ -15,6 +15,11 @@ const harnessConfig = {
1515 metroPort : DEFAULT_METRO_PORT ,
1616} as HarnessConfig ;
1717
18+ const harnessConfigWithoutNativeCrashDetection = {
19+ metroPort : DEFAULT_METRO_PORT ,
20+ detectNativeCrashes : false ,
21+ } as HarnessConfig ;
22+
1823describe ( 'iOS platform instance dependency validation' , ( ) => {
1924 beforeEach ( ( ) => {
2025 vi . restoreAllMocks ( ) ;
@@ -43,7 +48,7 @@ describe('iOS platform instance dependency validation', () => {
4348 expect ( assertInstalled ) . not . toHaveBeenCalled ( ) ;
4449 } ) ;
4550
46- it ( 'validates libimobiledevice before creating a physical device instance' , async ( ) => {
51+ it ( 'validates libimobiledevice before creating a physical device instance when native crash detection is enabled ' , async ( ) => {
4752 const assertInstalled = vi
4853 . spyOn ( libimobiledevice , 'assertLibimobiledeviceInstalled' )
4954 . mockRejectedValue ( new Error ( 'missing' ) ) ;
@@ -85,7 +90,7 @@ describe('iOS platform instance dependency validation', () => {
8590 expect ( getSimulatorId ) . toHaveBeenCalled ( ) ;
8691 } ) ;
8792
88- it ( 'does not try to discover the physical device when the dependency is missing' , async ( ) => {
93+ it ( 'does not try to discover the physical device when the dependency is missing and native crash detection is enabled ' , async ( ) => {
8994 vi . spyOn ( libimobiledevice , 'assertLibimobiledeviceInstalled' ) . mockRejectedValue (
9095 new Error ( 'missing' )
9196 ) ;
@@ -102,4 +107,37 @@ describe('iOS platform instance dependency validation', () => {
102107 ) . rejects . toThrow ( 'missing' ) ;
103108 expect ( getDeviceId ) . not . toHaveBeenCalled ( ) ;
104109 } ) ;
110+
111+ it ( 'skips libimobiledevice validation when native crash detection is disabled' , async ( ) => {
112+ const assertInstalled = vi
113+ . spyOn ( libimobiledevice , 'assertLibimobiledeviceInstalled' )
114+ . mockRejectedValue ( new Error ( 'missing' ) ) ;
115+ vi . spyOn ( devicectl , 'getDevice' ) . mockResolvedValue ( {
116+ identifier : 'physical-device-id' ,
117+ deviceProperties : {
118+ name : 'My iPhone' ,
119+ osVersionNumber : '18.0' ,
120+ } ,
121+ hardwareProperties : {
122+ marketingName : 'iPhone' ,
123+ productType : 'iPhone17,1' ,
124+ udid : '00008140-001600222422201C' ,
125+ } ,
126+ } ) ;
127+ vi . spyOn ( devicectl , 'isAppInstalled' ) . mockResolvedValue ( true ) ;
128+
129+ const config = {
130+ name : 'ios-device' ,
131+ device : { type : 'physical' as const , name : 'My iPhone' } ,
132+ bundleId : 'com.harnessplayground' ,
133+ } ;
134+
135+ await expect (
136+ getApplePhysicalDevicePlatformInstance (
137+ config ,
138+ harnessConfigWithoutNativeCrashDetection
139+ )
140+ ) . resolves . toBeDefined ( ) ;
141+ expect ( assertInstalled ) . not . toHaveBeenCalled ( ) ;
142+ } ) ;
105143} ) ;
0 commit comments