@@ -76,7 +76,7 @@ test('an older redirect is undone: the symlink goes and the host set comes back'
7676 fs . mkdirSync ( path . join ( paths . backupPath , 'HOST-UDID' ) , { recursive : true } ) ;
7777 fs . symlinkSync ( paths . scopedSetPath , paths . xctestDeviceSetPath , 'dir' ) ;
7878
79- restoreLegacyXctestDeviceSetRedirect ( paths . xctestDeviceSetPath ) ;
79+ restoreLegacyXctestDeviceSetRedirect ( IOS_SIMULATOR , paths . xctestDeviceSetPath ) ;
8080
8181 assert . equal ( fs . lstatSync ( paths . xctestDeviceSetPath ) . isSymbolicLink ( ) , false ) ;
8282 assert . ok ( fs . existsSync ( path . join ( paths . xctestDeviceSetPath , 'HOST-UDID' ) ) ) ;
@@ -85,22 +85,48 @@ test('an older redirect is undone: the symlink goes and the host set comes back'
8585 assert . ok ( fs . existsSync ( path . join ( paths . scopedSetPath , 'SCOPED-UDID' ) ) ) ;
8686} ) ;
8787
88- test ( 'a symlink an older redirect left without a backup is removed' , ( ) => {
88+ test ( 'a symlink an older redirect left into this scoped set without a backup is removed' , ( ) => {
8989 const paths = makeLegacyPaths ( ) ;
9090 fs . symlinkSync ( paths . scopedSetPath , paths . xctestDeviceSetPath , 'dir' ) ;
9191
92- restoreLegacyXctestDeviceSetRedirect ( paths . xctestDeviceSetPath ) ;
92+ restoreLegacyXctestDeviceSetRedirect (
93+ { ...IOS_SIMULATOR , simulatorSetPath : paths . scopedSetPath } ,
94+ paths . xctestDeviceSetPath ,
95+ ) ;
9396
9497 assert . equal ( fs . lstatSync ( paths . xctestDeviceSetPath , { throwIfNoEntry : false } ) , undefined ) ;
9598 assert . ok ( fs . existsSync ( path . join ( paths . scopedSetPath , 'SCOPED-UDID' ) ) ) ;
9699} ) ;
97100
101+ test ( 'a host-owned XCTestDevices symlink with no backup survives a default-set startup' , ( ) => {
102+ const paths = makeLegacyPaths ( ) ;
103+ fs . symlinkSync ( paths . scopedSetPath , paths . xctestDeviceSetPath , 'dir' ) ;
104+
105+ restoreLegacyXctestDeviceSetRedirect ( IOS_SIMULATOR , paths . xctestDeviceSetPath ) ;
106+
107+ assert . equal ( fs . readlinkSync ( paths . xctestDeviceSetPath ) , paths . scopedSetPath ) ;
108+ } ) ;
109+
110+ test ( 'a host-owned XCTestDevices symlink elsewhere survives a scoped-set startup' , ( ) => {
111+ const paths = makeLegacyPaths ( ) ;
112+ const external = path . join ( path . dirname ( paths . scopedSetPath ) , 'external-volume' ) ;
113+ fs . mkdirSync ( external ) ;
114+ fs . symlinkSync ( external , paths . xctestDeviceSetPath , 'dir' ) ;
115+
116+ restoreLegacyXctestDeviceSetRedirect (
117+ { ...IOS_SIMULATOR , simulatorSetPath : paths . scopedSetPath } ,
118+ paths . xctestDeviceSetPath ,
119+ ) ;
120+
121+ assert . equal ( fs . readlinkSync ( paths . xctestDeviceSetPath ) , external ) ;
122+ } ) ;
123+
98124test ( 'a backup never replaces a host set that is already in place' , ( ) => {
99125 const paths = makeLegacyPaths ( ) ;
100126 fs . mkdirSync ( path . join ( paths . xctestDeviceSetPath , 'CURRENT-UDID' ) , { recursive : true } ) ;
101127 fs . mkdirSync ( path . join ( paths . backupPath , 'OLD-UDID' ) , { recursive : true } ) ;
102128
103- restoreLegacyXctestDeviceSetRedirect ( paths . xctestDeviceSetPath ) ;
129+ restoreLegacyXctestDeviceSetRedirect ( IOS_SIMULATOR , paths . xctestDeviceSetPath ) ;
104130
105131 assert . ok ( fs . existsSync ( path . join ( paths . xctestDeviceSetPath , 'CURRENT-UDID' ) ) ) ;
106132 assert . ok ( fs . existsSync ( path . join ( paths . backupPath , 'OLD-UDID' ) ) ) ;
@@ -109,7 +135,7 @@ test('a backup never replaces a host set that is already in place', () => {
109135test ( 'a host with no leftovers is left untouched' , ( ) => {
110136 const paths = makeLegacyPaths ( ) ;
111137
112- restoreLegacyXctestDeviceSetRedirect ( paths . xctestDeviceSetPath ) ;
138+ restoreLegacyXctestDeviceSetRedirect ( IOS_SIMULATOR , paths . xctestDeviceSetPath ) ;
113139
114140 assert . equal ( fs . existsSync ( paths . xctestDeviceSetPath ) , false ) ;
115141 assert . equal ( fs . existsSync ( paths . backupPath ) , false ) ;
0 commit comments