ios-sim-portable
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -63,1 +63,2 @@ "use strict"; | ||
exports.spawn = spawn; | ||
//# sourceMappingURL=child-process.js.map |
@@ -43,1 +43,2 @@ "use strict"; | ||
exports.CommandExecutor = CommandExecutor; | ||
//# sourceMappingURL=command-executor.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -10,1 +11,2 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=device-types.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -25,1 +26,2 @@ const fs = require("fs"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=help.js.map |
@@ -10,1 +10,2 @@ "use strict"; | ||
exports.Command = Command; | ||
//# sourceMappingURL=launch.js.map |
@@ -10,1 +10,2 @@ "use strict"; | ||
exports.Command = Command; | ||
//# sourceMappingURL=notify-post.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -10,1 +11,2 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=sdks.js.map |
@@ -0,1 +1,3 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
//# sourceMappingURL=declarations.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -8,1 +9,2 @@ const util = require("util"); | ||
exports.fail = fail; | ||
//# sourceMappingURL=errors.js.map |
@@ -5,1 +5,2 @@ "use strict"; | ||
commandExecutor.execute(); | ||
//# sourceMappingURL=ios-sim-standalone.js.map |
@@ -89,1 +89,2 @@ "use strict"; | ||
module.exports = publicApi; | ||
//# sourceMappingURL=ios-sim.js.map |
@@ -53,1 +53,2 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=iphone-simulator-common.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -12,1 +13,2 @@ const options = require("./options"); | ||
exports.IPhoneSimulatorNameGetter = IPhoneSimulatorNameGetter; | ||
//# sourceMappingURL=iphone-simulator-name-getter.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -69,2 +70,4 @@ const childProcess = require("./child-process"); | ||
startApplication(deviceId, appIdentifier) { | ||
// simctl launch command does not launch the process immediately and we have to wait a little bit, | ||
// just to ensure all related processes and services are alive. | ||
const launchResult = this.simctl.launch(deviceId, appIdentifier); | ||
@@ -85,2 +88,3 @@ utils.sleep(0.5); | ||
if (xcodeMajorVersion && xcodeMajorVersion < 8) { | ||
// Xcode 7.x does not have support for `xcrun simctl terminate` command | ||
resultOfTermination = childProcess.execSync(`killall ${bundleExecutable}`, { skipError: true }); | ||
@@ -91,2 +95,5 @@ } | ||
} | ||
// killall command does not terminate the processes immediately and we have to wait a little bit, | ||
// just to ensure all related processes and services are dead. | ||
// Same is valid for simctl terminate when Simulator's OS version is below 10. | ||
utils.sleep(0.5); | ||
@@ -184,8 +191,9 @@ return resultOfTermination; | ||
startSimulator(device) { | ||
// In case the id is undefined, skip verification - we'll start default simulator. | ||
if (device && device.id) { | ||
this.verifyDevice(device); | ||
} | ||
if (!device || !device.runtimeVersion || !device.fullId) { | ||
device = this.getDeviceToRun(device); | ||
} | ||
if (device.id) { | ||
this.verifyDevice(device); | ||
} | ||
if (!this.isDeviceBooted(device)) { | ||
@@ -195,2 +203,3 @@ const isSimulatorAppRunning = this.isSimulatorAppRunning(); | ||
if (isSimulatorAppRunning) { | ||
// In case user closes simulator window but simulator app is still alive | ||
if (!haveBootedDevices) { | ||
@@ -205,2 +214,5 @@ device = this.getDeviceToRun(); | ||
common.startSimulator(device.id); | ||
// startSimulaltor doesn't always finish immediately, and the subsequent | ||
// install fails since the simulator is not running. | ||
// Give it some time to start before we attempt installing. | ||
utils.sleep(1); | ||
@@ -239,1 +251,2 @@ } | ||
exports.XCodeSimctlSimulator = XCodeSimctlSimulator; | ||
//# sourceMappingURL=iphone-simulator-xcode-simctl.js.map |
@@ -57,1 +57,2 @@ "use strict"; | ||
exports.iPhoneSimulator = iPhoneSimulator; | ||
//# sourceMappingURL=iphone-simulator.js.map |
@@ -0,1 +1,2 @@ | ||
///<reference path=".d.ts"/> | ||
"use strict"; | ||
@@ -26,2 +27,3 @@ var yargs = require("yargs"); | ||
var argv = yargs(process.argv.slice(2)).options(knownOptions).argv; | ||
// DO NOT REMOVE { } as when they are missing and some of the option values is false, the each stops as it thinks we have set "return false". | ||
_.each(_.keys(argv), optionName => { | ||
@@ -31,1 +33,2 @@ parsed[optionName] = argv[optionName]; | ||
module.exports = parsed; | ||
//# sourceMappingURL=options.js.map |
@@ -52,5 +52,15 @@ "use strict"; | ||
let rawDevices = this.simctlExec("list", ["devices"]); | ||
// expect to get a listing like | ||
// -- iOS 8.1 -- | ||
// iPhone 4s (3CA6E7DD-220E-45E5-B716-1E992B3A429C) (Shutdown) | ||
// ... | ||
// -- iOS 8.2 -- | ||
// iPhone 4s (A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E) (Shutdown) | ||
// ... | ||
// so, get the `-- iOS X.X --` line to find the sdk (X.X) | ||
// and the rest of the listing in order to later find the devices | ||
let deviceSectionRegex = /-- (iOS) (.+) --(\n .+)*/mg; | ||
let match = deviceSectionRegex.exec(rawDevices); | ||
let matches = []; | ||
// make an entry for each sdk version | ||
while (match !== null) { | ||
@@ -63,6 +73,17 @@ matches.push(match); | ||
} | ||
// get all the devices for each sdk | ||
let devices = []; | ||
for (match of matches) { | ||
let sdk = match[2]; | ||
// split the full match into lines and remove the first | ||
for (let line of match[0].split('\n').slice(1)) { | ||
// a line is something like | ||
// iPhone 4s (A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E) (Shutdown) | ||
// iPad Air 2 (9696A8ED-3020-49FC-90D6-DAFD29A0EA8D) (Shutdown) | ||
// iPad Pro (9.7 inch) (7FF984D4-0755-432D-BE0E-6EB44F0489CB) (Shutdown) | ||
// iPad Pro (12.9 inch) (F02012C8-6D4D-46FF-90D7-5DF90EF579E8) (Booted) | ||
// retrieve: | ||
// iPhone 4s | ||
// A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E | ||
// Shutdown | ||
let lineRegex = /^\s+(.*?)\s+\(([0-9A-F]{8}(?:-[0-9A-F]{4}){3}-[0-9A-F]{12})\)\s+\((.*?)\)(\s+\((?:.*?)\))?/; | ||
@@ -101,2 +122,4 @@ let lineMatch = lineRegex.exec(line); | ||
if (result.signal) { | ||
// In some cases, sending Ctrl + C (SIGINT) is handled by the simctl itself and spawnSync finishes, but the SIGINT does not stop current process. | ||
// In order to ensure the same signal is sent to the caller (CLI for example), send the signal manually: | ||
process.send(result.signal); | ||
@@ -115,1 +138,2 @@ } | ||
exports.Simctl = Simctl; | ||
//# sourceMappingURL=simctl.js.map |
@@ -17,1 +17,2 @@ "use strict"; | ||
exports.sleep = sleep; | ||
//# sourceMappingURL=utils.js.map |
@@ -18,1 +18,2 @@ "use strict"; | ||
exports.getXcodeVersionData = getXcodeVersionData; | ||
//# sourceMappingURL=xcode.js.map |
{ | ||
"name": "ios-sim-portable", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "", | ||
"main": "./lib/ios-sim.js", | ||
"scripts": { | ||
"prepublish": "node prepublish.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -46,2 +47,2 @@ }, | ||
} | ||
} | ||
} |
50450
865