Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build error #2356

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/simulator-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ async function createSim(caps) {
if (!deviceName) {
let deviceNames = 'none';
try {
deviceNames = await simctl
.getDevices(platformVersion, platform)
deviceNames = (await simctl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nice catch, which would be hardly possible without proper typing.
I am currently working on appium-ios-simulator lib changes, so it could also be properly typed

.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.`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to split a short error message into multiple lines

);
}

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
Loading