Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function detectUdid () {
log.debug('Auto-detecting real device udid...');
const udids = await utilities.getConnectedDevices();
if (_.isEmpty(udids)) {
throw new Error('No device is connected to the host');
}
const udid = _.last(udids);
if (udids.length > 1) {
log.warn(`Multiple devices found: ${udids.join(', ')}`);
log.warn(`Choosing '${udid}'. If this is wrong, manually set with 'udid' desired capability`);
}
log.debug(`Detected real device udid: '${udid}'`);
return udid;
}
async function getConnectedDevices () {
return await utilities.getConnectedDevices();
}