Skip to content

Commit 8bddcb6

Browse files
committedFeb 6, 2019
1 parent 98bcfe0 commit 8bddcb6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎local-cli/runIOS/findMatchingSimulator.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,24 @@ function findMatchingSimulator(simulators, simulatorString) {
3939
}
4040

4141
var match;
42-
for (let version in devices) {
42+
for (const versionDescriptor in devices) {
43+
const device = devices[versionDescriptor];
44+
let version = versionDescriptor;
45+
46+
if ((/^com\.apple\.CoreSimulator\.SimRuntime\./g).test(version)) {
47+
// Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2"
48+
version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3');
49+
}
50+
4351
// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
4452
if (!version.includes('iOS') && !version.includes('tvOS')) {
4553
continue;
4654
}
4755
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
4856
continue;
4957
}
50-
for (let i in devices[version]) {
51-
let simulator = devices[version][i];
58+
for (const i in device) {
59+
const simulator = device[i];
5260
// Skipping non-available simulator
5361
if (
5462
simulator.availability !== '(available)' &&

0 commit comments

Comments
 (0)