Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ios-sim-portable

Package Overview
Dependencies
Maintainers
5
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ios-sim-portable - npm Package Compare versions

Comparing version 3.3.2 to 3.3.3-rc.0

3

lib/commands/launch.js
"use strict";
const iphoneSimulatorLibPath = require("./../iphone-simulator");
const options = require("../options");
class Command {
execute(args) {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
return iphoneSimulator.run(args[0], args[1]);
return iphoneSimulator.run(args[0], args[1], options);
}
}
exports.Command = Command;

@@ -6,5 +6,5 @@ "use strict";

var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
return iphoneSimulator.sendNotification(args[0]);
return iphoneSimulator.sendNotification(args[0], args[1]);
}
}
exports.Command = Command;

@@ -70,2 +70,20 @@ "use strict";

});
Object.defineProperty(publicApi, "launchApplication", {
get: () => {
return (...args) => {
let libraryPath = require("./iphone-simulator");
let obj = new libraryPath.iPhoneSimulator();
return obj.run.apply(obj, args);
};
}
});
Object.defineProperty(publicApi, "printDeviceTypes", {
get: () => {
return (...args) => {
let libraryPath = require("./iphone-simulator");
let obj = new libraryPath.iPhoneSimulator();
return obj.printDeviceTypes.apply(obj, args);
};
}
});
["installApplication",

@@ -75,7 +93,8 @@ "uninstallApplication",

"stopApplication",
"printDeviceLog",
"run",
"getDeviceLogProcess",
"startSimulator",
"getSimulatorName",
"getDevices"].forEach(methodName => {
"getDevices",
"sendNotification"].forEach(methodName => {
Object.defineProperty(publicApi, methodName, {

@@ -82,0 +101,0 @@ get: () => {

"use strict";
const options = require("./options");
class IPhoneSimulatorNameGetter {
getSimulatorName(deviceName) {
if (!this._simulatorName) {
this._simulatorName = options.device || deviceName || this.defaultDeviceIdentifier;
this._simulatorName = deviceName || this.defaultDeviceIdentifier;
}

@@ -8,0 +7,0 @@ return this._simulatorName;

@@ -5,3 +5,2 @@ "use strict";

const common = require("./iphone-simulator-common");
const options = require("./options");
const path = require("path");

@@ -35,4 +34,4 @@ const simctl_1 = require("./simctl");

}
run(applicationPath, applicationIdentifier) {
let device = this.getDeviceToRun();
run(applicationPath, applicationIdentifier, options) {
let device = this.getDeviceToRun(options);
let currentBootedDevice = _.find(this.getDevices(), device => this.isDeviceBooted(device));

@@ -42,17 +41,14 @@ if (currentBootedDevice && (currentBootedDevice.name.toLowerCase() !== device.name.toLowerCase() || currentBootedDevice.runtimeVersion !== device.runtimeVersion)) {

}
this.startSimulator(device);
this.startSimulator(options, device);
if (!options.skipInstall) {
this.simctl.install(device.id, applicationPath);
}
let launchResult = this.simctl.launch(device.id, applicationIdentifier);
if (options.logging) {
this.printDeviceLog(device.id, launchResult);
}
return this.simctl.launch(device.id, applicationIdentifier, options);
}
sendNotification(notification) {
let device = this.getBootedDevice();
sendNotification(notification, deviceId) {
let device = this.getDeviceFromIdentifier(deviceId);
if (!device) {
errors.fail("Could not find device.");
}
this.simctl.notifyPost("booted", notification);
this.simctl.notifyPost(deviceId, notification);
}

@@ -71,4 +67,4 @@ getApplicationPath(deviceId, applicationIdentifier) {

}
startApplication(deviceId, appIdentifier) {
const launchResult = this.simctl.launch(deviceId, appIdentifier);
startApplication(deviceId, appIdentifier, options) {
const launchResult = this.simctl.launch(deviceId, appIdentifier, options);
utils.sleep(0.5);

@@ -99,30 +95,2 @@ return launchResult;

}
printDeviceLog(deviceId, launchResult) {
let pid = "";
let deviceLogChildProcess;
if (launchResult) {
pid = launchResult.split(":")[1].trim();
}
if (!this.isDeviceLogOperationStarted) {
deviceLogChildProcess = this.getDeviceLogProcess(deviceId);
if (deviceLogChildProcess.stdout) {
deviceLogChildProcess.stdout.on("data", this.logDataHandler.bind(this, pid));
}
if (deviceLogChildProcess.stderr) {
deviceLogChildProcess.stderr.on("data", this.logDataHandler.bind(this, pid));
}
}
return deviceLogChildProcess;
}
logDataHandler(pid, logData) {
const dataAsString = logData.toString();
if (pid) {
if (dataAsString.indexOf(`[${pid}]`) > -1) {
process.stdout.write(dataAsString);
}
}
else {
process.stdout.write(dataAsString);
}
}
getDeviceLogProcess(deviceId, predicate) {

@@ -144,3 +112,3 @@ if (!this.isDeviceLogOperationStarted) {

}
getDeviceToRun(device) {
getDeviceToRun(options, device) {
let devices = _.sortBy(this.simctl.getDevices(), (device) => device.runtimeVersion), sdkVersion = options.sdkVersion || options.sdk, deviceIdOrName = options.device;

@@ -186,9 +154,10 @@ if (device && (device.sdkVersion || device.sdk)) {

}
startSimulator(device) {
startSimulator(options, device) {
device = device || this.getDeviceToRun(options);
if (device && device.id) {
this.verifyDevice(device);
}
if (!device || !device.runtimeVersion || !device.fullId) {
device = this.getDeviceToRun(device);
device = this.getDeviceToRun(options, device);
}
if (device.id) {
this.verifyDevice(device);
}
if (!this.isDeviceBooted(device)) {

@@ -199,3 +168,3 @@ const isSimulatorAppRunning = this.isSimulatorAppRunning();

if (!haveBootedDevices) {
device = this.getDeviceToRun();
device = this.getDeviceToRun(options);
}

@@ -202,0 +171,0 @@ this.simctl.boot(device.id);

@@ -5,3 +5,2 @@ "use strict";

const errors = require("./errors");
const options = require("./options");
const iphone_simulator_xcode_simctl_1 = require("./iphone-simulator-xcode-simctl");

@@ -14,3 +13,3 @@ const _ = require("lodash");

}
run(applicationPath, applicationIdentifier) {
run(applicationPath, applicationIdentifier, options) {
if (!fs.existsSync(applicationPath)) {

@@ -32,3 +31,3 @@ errors.fail("Path does not exist ", applicationPath);

}
return this.simulator.run(applicationPath, applicationIdentifier);
return this.simulator.run(applicationPath, applicationIdentifier, options);
}

@@ -49,7 +48,7 @@ printDeviceTypes() {

}
sendNotification(notification) {
sendNotification(notification, deviceId) {
if (!notification) {
errors.fail("Notification required.");
}
return this.simulator.sendNotification(notification);
return this.simulator.sendNotification(notification, deviceId);
}

@@ -56,0 +55,0 @@ createSimulator() {

@@ -10,11 +10,5 @@ "use strict";

"debug": { type: OptionType.Boolean },
"exit": { type: OptionType.Boolean },
"device": { type: OptionType.String },
"stdout": { type: OptionType.String },
"stderr": { type: OptionType.String },
"env": { type: OptionType.String },
"args": { type: OptionType.String },
"timeout": { type: OptionType.String },
"help": { type: OptionType.Boolean },
"logging": { type: OptionType.Boolean },
"waitForDebugger": { type: OptionType.Boolean },

@@ -21,0 +15,0 @@ "sdkVersion": { type: OptionType.String },

@@ -5,6 +5,6 @@ "use strict";

const errors = require("./errors");
const options = require("./options");
const _ = require("lodash");
class Simctl {
launch(deviceId, appIdentifier) {
launch(deviceId, appIdentifier, options) {
options = options || {};
let args = [];

@@ -11,0 +11,0 @@ if (options.waitForDebugger) {

{
"name": "ios-sim-portable",
"version": "3.3.2",
"version": "3.3.3-rc.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/ios-sim.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc