in lib/utils/utilities.js [67:102]
function getSimulatorModelId (cli, target) {
target = new RegExp(target || '^iPhone');
const args = [
'run',
'ios',
'--list',
'--emulator'
].concat(module.exports.PARAMEDIC_COMMON_ARGS);
// Fetches all known simulators/emulators.
logger.info('running:');
logger.info(` ${cli} ${args.join(' ')}`);
const result = execa.sync(cli, args);
if (result.exitCode > 0) {
logger.error('Failed to find simulator we deployed to');
return;
}
logger.info(`Avaliable Emulators:\n${result.stdout}`);
logger.info(`Filtering for Targeted Emulator: ${target}`);
// Return the individual target that is filtered from the known simulators/emulators based on provided target name. (default: ^iPhone)
const allSimulators = result.stdout
.split('\n');
const matchingSimulators = allSimulators.filter(i => i.match(target));
if (!matchingSimulators.length) {
logger.warn('Unable to find requested simulator, falling back to the first available!');
return allSimulators.filter(i => i.match(/^iPhone/))[0].trim();
}
return matchingSimulators
.pop()
.trim();
}