Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async startUIClient (opts = {}) {
opts = Object.assign({
scaleFactor: null,
connectHardwareKeyboard: false,
startupTimeout: this.startupTimeout,
}, opts);
const simulatorApp = path.resolve(await getXcodePath(), 'Applications', this.simulatorApp);
const args = ['-Fn', simulatorApp, '--args', '-CurrentDeviceUDID', this.udid];
if (opts.scaleFactor) {
const stat = await this.stat();
const formattedDeviceName = stat.name.replace(/\s+/g, '-');
const argumentName = `-SimulatorWindowLastScale-com.apple.CoreSimulator.SimDeviceType.${formattedDeviceName}`;
args.push(argumentName, opts.scaleFactor);
}
if (_.isBoolean(opts.connectHardwareKeyboard)) {
args.push('-ConnectHardwareKeyboard', opts.connectHardwareKeyboard ? '1' : '0');
}
log.info(`Starting Simulator UI with command: open ${args.join(' ')}`);
try {
await exec('open', args, {timeout: opts.startupTimeout});