ios-sim-portable
Advanced tools
@@ -63,2 +63,1 @@ "use strict"; | ||
exports.spawn = spawn; | ||
//# sourceMappingURL=child-process.js.map |
@@ -43,2 +43,1 @@ "use strict"; | ||
exports.CommandExecutor = CommandExecutor; | ||
//# sourceMappingURL=command-executor.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -11,2 +10,1 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=device-types.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -26,2 +25,1 @@ const fs = require("fs"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=help.js.map |
@@ -11,2 +11,1 @@ "use strict"; | ||
exports.Command = Command; | ||
//# sourceMappingURL=launch.js.map |
@@ -10,2 +10,1 @@ "use strict"; | ||
exports.Command = Command; | ||
//# sourceMappingURL=notify-post.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path=".././.d.ts"/> | ||
"use strict"; | ||
@@ -11,2 +10,1 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator"); | ||
exports.Command = Command; | ||
//# sourceMappingURL=sdks.js.map |
@@ -1,3 +0,1 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
//# sourceMappingURL=declarations.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -9,2 +8,1 @@ const util = require("util"); | ||
exports.fail = fail; | ||
//# sourceMappingURL=errors.js.map |
@@ -5,2 +5,1 @@ "use strict"; | ||
commandExecutor.execute(); | ||
//# sourceMappingURL=ios-sim-standalone.js.map |
@@ -141,2 +141,1 @@ "use strict"; | ||
module.exports = publicApi; | ||
//# sourceMappingURL=ios-sim.js.map |
@@ -53,2 +53,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=iphone-simulator-common.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -12,2 +11,1 @@ class IPhoneSimulatorNameGetter { | ||
exports.IPhoneSimulatorNameGetter = IPhoneSimulatorNameGetter; | ||
//# sourceMappingURL=iphone-simulator-name-getter.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path="./.d.ts"/> | ||
"use strict"; | ||
@@ -35,7 +34,3 @@ const childProcess = require("./child-process"); | ||
run(applicationPath, applicationIdentifier, options) { | ||
let device = this.getDeviceToRun(options); | ||
let currentBootedDevice = _.find(this.getDevices(), device => this.isDeviceBooted(device)); | ||
if (currentBootedDevice && (currentBootedDevice.name.toLowerCase() !== device.name.toLowerCase() || currentBootedDevice.runtimeVersion !== device.runtimeVersion)) { | ||
this.killSimulator(); | ||
} | ||
const device = this.getDeviceToRun(options); | ||
this.startSimulator(options, device); | ||
@@ -67,4 +62,2 @@ if (!options.skipInstall) { | ||
startApplication(deviceId, appIdentifier, options) { | ||
// 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, options); | ||
@@ -85,3 +78,2 @@ 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 }); | ||
@@ -92,5 +84,2 @@ } | ||
} | ||
// 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); | ||
@@ -161,3 +150,2 @@ return resultOfTermination; | ||
device = device || this.getDeviceToRun(options); | ||
// In case the id is undefined, skip verification - we'll start default simulator. | ||
if (device && device.id) { | ||
@@ -173,3 +161,2 @@ this.verifyDevice(device); | ||
if (isSimulatorAppRunning) { | ||
// In case user closes simulator window but simulator app is still alive | ||
if (!haveBootedDevices) { | ||
@@ -184,5 +171,2 @@ device = this.getDeviceToRun(options); | ||
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); | ||
@@ -221,2 +205,1 @@ } | ||
exports.XCodeSimctlSimulator = XCodeSimctlSimulator; | ||
//# sourceMappingURL=iphone-simulator-xcode-simctl.js.map |
@@ -17,5 +17,5 @@ "use strict"; | ||
if (options.device) { | ||
let deviceNames = _.unique(_.map(this.simulator.getDevices(), (device) => device.name)); | ||
if (!_.contains(deviceNames, options.device)) { | ||
errors.fail(`Unable to find device ${options.device}. The valid device names are ${deviceNames.join(", ")}`); | ||
const hasSuchDevice = _.find(this.simulator.getDevices(), device => device.name === options.device || device.id === options.device); | ||
if (!hasSuchDevice) { | ||
errors.fail(`Unable to find device ${options.device}.`); | ||
} | ||
@@ -57,2 +57,1 @@ } | ||
exports.iPhoneSimulator = iPhoneSimulator; | ||
//# sourceMappingURL=iphone-simulator.js.map |
@@ -1,2 +0,1 @@ | ||
///<reference path=".d.ts"/> | ||
"use strict"; | ||
@@ -21,3 +20,2 @@ 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 => { | ||
@@ -27,2 +25,1 @@ parsed[optionName] = argv[optionName]; | ||
module.exports = parsed; | ||
//# sourceMappingURL=options.js.map |
@@ -52,15 +52,5 @@ "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) { | ||
@@ -73,17 +63,6 @@ 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+\((?:.*?)\))?/; | ||
@@ -122,4 +101,2 @@ 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); | ||
@@ -138,2 +115,1 @@ } | ||
exports.Simctl = Simctl; | ||
//# sourceMappingURL=simctl.js.map |
@@ -17,2 +17,1 @@ "use strict"; | ||
exports.sleep = sleep; | ||
//# sourceMappingURL=utils.js.map |
@@ -18,2 +18,1 @@ "use strict"; | ||
exports.getXcodeVersionData = getXcodeVersionData; | ||
//# sourceMappingURL=xcode.js.map |
{ | ||
"name": "ios-sim-portable", | ||
"version": "3.4.2", | ||
"version": "3.4.3", | ||
"description": "", | ||
"main": "./lib/ios-sim.js", | ||
"scripts": { | ||
"prepublish": "node prepublish.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -47,2 +46,2 @@ }, | ||
} | ||
} | ||
} |
47217
-7.62%832
-5.35%