Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
after(async function () {
try {
await killAllSimulators();
for (const udid of _.keys(simulatorsMapping)) {
try {
await simctl.deleteDevice(udid);
} catch (err) {
console.log(`Error deleting simulator '${udid}': ${err.message}`); // eslint-disable-line
}
}
} finally {
simulatorsMapping = {};
}
});
beforeEach(killAllSimulators);
async function deleteSimulator (udid, version) {
// only want to get rid of the device if it is present
let devices = await simctl.getDevices();
if (!devices[version]) {
return;
}
let devicePresent = devices[version]
.filter((device) => {
return device.udid === udid;
}).length > 0;
if (devicePresent) {
await simctl.deleteDevice(udid);
}
}
after(async function () {
// only want to get rid of the device if it is present
let devicePresent = (await simctl.getDevices())[deviceType.version]
.filter((device) => {
return device.udid === udid;
}).length > 0;
if (devicePresent) {
await killAllSimulators();
await simctl.deleteDevice(udid);
}
});
afterEach(async function () {
await killAllSimulators();
try {
await simctl.deleteDevice(sim.udid);
} catch (ign) {}
});
it('should be able to kill the simulators', async function () {
after(async function () {
this.timeout(MOCHA_TIMEOUT);
await shutdownSimulator(device);
await deleteDevice(device.udid);
});
extensions.isolateSim = async function isolateSim () {
log.debug('Isolating the requested simulator by deleting all others');
let udids = await getAllUdids();
for (let udid of _.without(udids, this.udid)) {
await deleteDevice(udid);
}
};
async delete () {
await simctl.deleteDevice(this.udid);
}