node-simctl
Advanced tools
Comparing version 7.5.2 to 7.5.3
@@ -6,3 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getXcrunBinary = exports.normalizeVersion = exports.SIM_RUNTIME_NAME = exports.DEFAULT_EXEC_TIMEOUT = void 0; | ||
exports.SIM_RUNTIME_NAME = exports.DEFAULT_EXEC_TIMEOUT = void 0; | ||
exports.normalizeVersion = normalizeVersion; | ||
exports.getXcrunBinary = getXcrunBinary; | ||
const semver_1 = __importDefault(require("semver")); | ||
@@ -26,3 +28,2 @@ exports.DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms | ||
} | ||
exports.normalizeVersion = normalizeVersion; | ||
/** | ||
@@ -34,3 +35,2 @@ * @returns {string} | ||
} | ||
exports.getXcrunBinary = getXcrunBinary; | ||
//# sourceMappingURL=helpers.js.map |
@@ -155,7 +155,7 @@ export default Simctl; | ||
*/ | ||
exec<TExecOpts extends ExecOpts>(subcommand: string, opts?: TExecOpts | undefined): Promise<TExecOpts extends TAsyncOpts ? SubProcess : import("teen_process").TeenProcessExecResult<any>>; | ||
exec<TExecOpts extends ExecOpts>(subcommand: string, opts?: TExecOpts | undefined): Promise<TExecOpts extends TAsyncOpts ? import("teen_process").SubProcess : import("teen_process").TeenProcessExecResult<any>>; | ||
addMedia: (this: Simctl, filePath: string) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
appInfo: (this: Simctl, bundleId: string) => Promise<string>; | ||
bootDevice: (this: Simctl) => Promise<void>; | ||
startBootMonitor: (this: Simctl, opts?: import("./subcommands/bootstatus").BootMonitorOptions | undefined) => Promise<SubProcess>; | ||
startBootMonitor: (this: Simctl, opts?: import("./subcommands/bootstatus").BootMonitorOptions | undefined) => Promise<import("teen_process").SubProcess>; | ||
createDevice: (this: Simctl, name: string, deviceTypeId: string, platformVersion: string, opts?: import("./subcommands/create").SimCreationOpts | undefined) => Promise<string>; | ||
@@ -173,3 +173,3 @@ deleteDevice: (this: Simctl) => Promise<void>; | ||
getDevicesByParsing: (this: Simctl, platform?: string | null | undefined) => Promise<Record<string, any>>; | ||
getDevices: (this: Simctl, forSdk?: string | null | undefined, platform?: string | null | undefined) => Promise<any>; | ||
getDevices: (this: Simctl, forSdk?: string | null | undefined, platform?: string | null | undefined) => Promise<any | DeviceInfo[]>; | ||
getRuntimeForPlatformVersionViaJson: (this: Simctl, platformVersion: string, platform?: string | undefined) => Promise<string>; | ||
@@ -189,4 +189,4 @@ getRuntimeForPlatformVersion: (this: Simctl, platformVersion: string, platform?: string | undefined) => Promise<string>; | ||
shutdownDevice: (this: Simctl) => Promise<void>; | ||
spawnProcess: (this: Simctl, args: string | string[], env?: any) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
spawnSubProcess: (this: Simctl, args: string | string[], env?: any) => Promise<SubProcess>; | ||
spawnProcess: (this: Simctl, args: string | string[], env?: object) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
spawnSubProcess: (this: Simctl, args: string | string[], env?: object) => Promise<import("teen_process").SubProcess>; | ||
terminateApp: (this: Simctl, bundleId: string) => Promise<void>; | ||
@@ -193,0 +193,0 @@ getAppearance: (this: Simctl) => Promise<string>; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const asyncbox_1 = require("asyncbox"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const commands = {}; | ||
@@ -37,3 +38,4 @@ /** | ||
const udid = this.requireUdid('bootstatus'); | ||
let status = ''; | ||
/** @type {string[]} */ | ||
const status = []; | ||
let isBootingFinished = false; | ||
@@ -50,14 +52,15 @@ let error = null; | ||
}); | ||
bootMonitor.on('output', (stdout, stderr) => { | ||
status += stdout || stderr; | ||
if (stdout) { | ||
if (stdout.includes('Waiting on Data Migration') && onWaitingDataMigration) { | ||
onWaitingDataMigration(); | ||
} | ||
else if (stdout.includes('Waiting on System App') && onWaitingSystemApp) { | ||
onWaitingSystemApp(); | ||
} | ||
const onStreamLine = (/** @type {string} */ line) => { | ||
status.push(line); | ||
if (onWaitingDataMigration && line.includes('Waiting on Data Migration')) { | ||
onWaitingDataMigration(); | ||
} | ||
}); | ||
bootMonitor.on('exit', (code, signal) => { | ||
else if (onWaitingSystemApp && line.includes('Waiting on System App')) { | ||
onWaitingSystemApp(); | ||
} | ||
}; | ||
for (const streamName of ['stdout', 'stderr']) { | ||
bootMonitor.on(`line-${streamName}`, onStreamLine); | ||
} | ||
bootMonitor.once('exit', (code, signal) => { | ||
if (timeoutHandler) { | ||
@@ -73,4 +76,6 @@ clearTimeout(timeoutHandler); | ||
else { | ||
status = status || signal; | ||
error = new Error(status); | ||
const errMessage = lodash_1.default.isEmpty(status) | ||
? `The simulator booting process has exited with code ${code} by signal ${signal}` | ||
: status.join('\n'); | ||
error = new Error(errMessage); | ||
if (onError) { | ||
@@ -109,3 +114,3 @@ onError(error); | ||
throw new Error(`The simulator ${udid} has failed to finish booting after ${seconds}s. ` + | ||
`Original status: ${status}`); | ||
`Original status: ${status.join('\n')}`); | ||
} | ||
@@ -112,0 +117,0 @@ } |
@@ -58,3 +58,3 @@ export default commands; | ||
*/ | ||
function getDevices(this: import("../simctl").default, forSdk?: string | null | undefined, platform?: string | null | undefined): Promise<any>; | ||
function getDevices(this: import("../simctl").default, forSdk?: string | null | undefined, platform?: string | null | undefined): Promise<any | DeviceInfo[]>; | ||
/** | ||
@@ -61,0 +61,0 @@ * Get the runtime for the particular platform version using --json flag |
@@ -15,3 +15,3 @@ export default commands; | ||
*/ | ||
function spawnProcess(this: import("../simctl").default, args: string | string[], env?: any): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
function spawnProcess(this: import("../simctl").default, args: string | string[], env?: object): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
/** | ||
@@ -27,4 +27,4 @@ * Prepare SubProcess instance for a new process, which is going to be spawned | ||
*/ | ||
function spawnSubProcess(this: import("../simctl").default, args: string | string[], env?: any): Promise<import("teen_process").SubProcess>; | ||
function spawnSubProcess(this: import("../simctl").default, args: string | string[], env?: object): Promise<import("teen_process").SubProcess>; | ||
} | ||
//# sourceMappingURL=spawn.d.ts.map |
@@ -0,1 +1,7 @@ | ||
## [7.5.3](https://github.com/appium/node-simctl/compare/v7.5.2...v7.5.3) (2024-07-03) | ||
### Miscellaneous Chores | ||
* Simplify booting status monitoring ([#250](https://github.com/appium/node-simctl/issues/250)) ([508a2e5](https://github.com/appium/node-simctl/commit/508a2e55021c8bc8119c07ba20fbc2073bd84192)) | ||
## [7.5.2](https://github.com/appium/node-simctl/compare/v7.5.1...v7.5.2) (2024-06-18) | ||
@@ -2,0 +8,0 @@ |
import log from '../logger'; | ||
import { waitForCondition } from 'asyncbox'; | ||
import _ from 'lodash'; | ||
const commands = {}; | ||
@@ -43,3 +43,4 @@ | ||
let status = ''; | ||
/** @type {string[]} */ | ||
const status = []; | ||
let isBootingFinished = false; | ||
@@ -56,13 +57,14 @@ let error = null; | ||
}); | ||
bootMonitor.on('output', (stdout, stderr) => { | ||
status += stdout || stderr; | ||
if (stdout) { | ||
if (stdout.includes('Waiting on Data Migration') && onWaitingDataMigration) { | ||
onWaitingDataMigration(); | ||
} else if (stdout.includes('Waiting on System App') && onWaitingSystemApp) { | ||
onWaitingSystemApp(); | ||
} | ||
const onStreamLine = (/** @type {string} */ line) => { | ||
status.push(line); | ||
if (onWaitingDataMigration && line.includes('Waiting on Data Migration')) { | ||
onWaitingDataMigration(); | ||
} else if (onWaitingSystemApp && line.includes('Waiting on System App')) { | ||
onWaitingSystemApp(); | ||
} | ||
}); | ||
bootMonitor.on('exit', (code, signal) => { | ||
}; | ||
for (const streamName of ['stdout', 'stderr']) { | ||
bootMonitor.on(`line-${streamName}`, onStreamLine); | ||
} | ||
bootMonitor.once('exit', (code, signal) => { | ||
if (timeoutHandler) { | ||
@@ -77,4 +79,6 @@ clearTimeout(timeoutHandler); | ||
} else { | ||
status = status || signal; | ||
error = new Error(status); | ||
const errMessage = _.isEmpty(status) | ||
? `The simulator booting process has exited with code ${code} by signal ${signal}` | ||
: status.join('\n'); | ||
error = new Error(errMessage); | ||
if (onError) { | ||
@@ -111,3 +115,4 @@ onError(error); | ||
`The simulator ${udid} has failed to finish booting after ${seconds}s. ` + | ||
`Original status: ${status}`); | ||
`Original status: ${status.join('\n')}` | ||
); | ||
} | ||
@@ -114,0 +119,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "7.5.2", | ||
"version": "7.5.3", | ||
"author": "Appium Contributors", | ||
@@ -44,3 +44,3 @@ "license": "Apache-2.0", | ||
"source-map-support": "^0.x", | ||
"teen_process": "^2.0.0", | ||
"teen_process": "^2.2.0", | ||
"uuid": "^10.0.0", | ||
@@ -66,3 +66,2 @@ "which": "^4.0.0" | ||
"devDependencies": { | ||
"@appium/eslint-config-appium": "^8.0.4", | ||
"@appium/eslint-config-appium-ts": "^0.x", | ||
@@ -69,0 +68,0 @@ "@appium/tsconfig": "^0.x", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243028
21
4134
Updatedteen_process@^2.2.0