Skip to content

Commit

Permalink
fix: build error (#2356)
Browse files Browse the repository at this point in the history
* fix: build error

* simplify a bit
  • Loading branch information
KazuCocoa authored Mar 25, 2024
1 parent 63589a1 commit 5c5ebc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/simulator-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@ async function createSim(caps) {
if (!deviceName) {
let deviceNames = 'none';
try {
deviceNames = await simctl
.getDevices(platformVersion, platform)
deviceNames = (await simctl
.getDevices(platformVersion, platform))
.map(({deviceName}) => deviceName);
} catch (ign) {}
throw new Error(
`'deviceName' must be provided in order to create a new Simulator for ${platform} platform. ` +
`Currently available device names: ${deviceNames}`,
);
}

if (!platformVersion) {
throw new Error(`'platformVersion' is required.`);
}

const simName = `${APPIUM_SIM_PREFIX}-${util.uuidV4().toUpperCase()}-${deviceName}`;
log.debug(`Creating a temporary Simulator device '${simName}'`);
const udid = await simctl.createDevice(simName, deviceName, platformVersion, {platform});
Expand Down

0 comments on commit 5c5ebc3

Please sign in to comment.