node-simctl 8.1.5 → 8.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/helpers.d.ts.map +1 -1
  3. package/build/lib/helpers.js.map +1 -1
  4. package/build/lib/index.d.ts +5 -0
  5. package/build/lib/index.d.ts.map +1 -0
  6. package/build/{index.js → lib/index.js} +1 -1
  7. package/build/lib/index.js.map +1 -0
  8. package/build/lib/logger.js.map +1 -1
  9. package/build/lib/simctl.d.ts.map +1 -1
  10. package/build/lib/simctl.js +5 -2
  11. package/build/lib/simctl.js.map +1 -1
  12. package/build/lib/subcommands/addmedia.d.ts.map +1 -1
  13. package/build/lib/subcommands/addmedia.js.map +1 -1
  14. package/build/lib/subcommands/appinfo.d.ts.map +1 -1
  15. package/build/lib/subcommands/appinfo.js.map +1 -1
  16. package/build/lib/subcommands/boot.d.ts.map +1 -1
  17. package/build/lib/subcommands/boot.js +1 -1
  18. package/build/lib/subcommands/boot.js.map +1 -1
  19. package/build/lib/subcommands/bootstatus.d.ts.map +1 -1
  20. package/build/lib/subcommands/bootstatus.js.map +1 -1
  21. package/build/lib/subcommands/create.d.ts.map +1 -1
  22. package/build/lib/subcommands/create.js +2 -2
  23. package/build/lib/subcommands/create.js.map +1 -1
  24. package/build/lib/subcommands/delete.d.ts.map +1 -1
  25. package/build/lib/subcommands/delete.js +1 -1
  26. package/build/lib/subcommands/erase.d.ts.map +1 -1
  27. package/build/lib/subcommands/erase.js +1 -1
  28. package/build/lib/subcommands/erase.js.map +1 -1
  29. package/build/lib/subcommands/get_app_container.d.ts.map +1 -1
  30. package/build/lib/subcommands/getenv.d.ts.map +1 -1
  31. package/build/lib/subcommands/getenv.js.map +1 -1
  32. package/build/lib/subcommands/install.d.ts.map +1 -1
  33. package/build/lib/subcommands/install.js.map +1 -1
  34. package/build/lib/subcommands/io.d.ts.map +1 -1
  35. package/build/lib/subcommands/io.js.map +1 -1
  36. package/build/lib/subcommands/keychain.d.ts.map +1 -1
  37. package/build/lib/subcommands/keychain.js +2 -2
  38. package/build/lib/subcommands/keychain.js.map +1 -1
  39. package/build/lib/subcommands/launch.d.ts.map +1 -1
  40. package/build/lib/subcommands/launch.js.map +1 -1
  41. package/build/lib/subcommands/list.d.ts.map +1 -1
  42. package/build/lib/subcommands/list.js +4 -3
  43. package/build/lib/subcommands/list.js.map +1 -1
  44. package/build/lib/subcommands/location.d.ts.map +1 -1
  45. package/build/lib/subcommands/location.js.map +1 -1
  46. package/build/lib/subcommands/openurl.d.ts.map +1 -1
  47. package/build/lib/subcommands/openurl.js.map +1 -1
  48. package/build/lib/subcommands/pbcopy.d.ts.map +1 -1
  49. package/build/lib/subcommands/pbcopy.js +2 -2
  50. package/build/lib/subcommands/pbcopy.js.map +1 -1
  51. package/build/lib/subcommands/pbpaste.d.ts.map +1 -1
  52. package/build/lib/subcommands/pbpaste.js.map +1 -1
  53. package/build/lib/subcommands/privacy.d.ts.map +1 -1
  54. package/build/lib/subcommands/privacy.js.map +1 -1
  55. package/build/lib/subcommands/push.d.ts.map +1 -1
  56. package/build/lib/subcommands/push.js.map +1 -1
  57. package/build/lib/subcommands/shutdown.d.ts.map +1 -1
  58. package/build/lib/subcommands/shutdown.js.map +1 -1
  59. package/build/lib/subcommands/spawn.d.ts.map +1 -1
  60. package/build/lib/subcommands/spawn.js +2 -2
  61. package/build/lib/subcommands/spawn.js.map +1 -1
  62. package/build/lib/subcommands/terminate.d.ts.map +1 -1
  63. package/build/lib/subcommands/terminate.js.map +1 -1
  64. package/build/lib/subcommands/ui.d.ts.map +1 -1
  65. package/build/lib/subcommands/ui.js.map +1 -1
  66. package/build/lib/subcommands/uninstall.d.ts.map +1 -1
  67. package/build/lib/subcommands/uninstall.js.map +1 -1
  68. package/build/lib/types.d.ts.map +1 -1
  69. package/lib/helpers.ts +9 -8
  70. package/{index.ts → lib/index.ts} +3 -3
  71. package/lib/logger.ts +2 -2
  72. package/lib/simctl.ts +34 -32
  73. package/lib/subcommands/addmedia.ts +6 -3
  74. package/lib/subcommands/appinfo.ts +5 -5
  75. package/lib/subcommands/boot.ts +4 -4
  76. package/lib/subcommands/bootstatus.ts +82 -80
  77. package/lib/subcommands/create.ts +22 -20
  78. package/lib/subcommands/delete.ts +3 -4
  79. package/lib/subcommands/erase.ts +10 -8
  80. package/lib/subcommands/get_app_container.ts +3 -4
  81. package/lib/subcommands/getenv.ts +2 -3
  82. package/lib/subcommands/install.ts +2 -3
  83. package/lib/subcommands/io.ts +4 -5
  84. package/lib/subcommands/keychain.ts +21 -24
  85. package/lib/subcommands/launch.ts +7 -4
  86. package/lib/subcommands/list.ts +48 -38
  87. package/lib/subcommands/location.ts +5 -6
  88. package/lib/subcommands/openurl.ts +3 -3
  89. package/lib/subcommands/pbcopy.ts +6 -7
  90. package/lib/subcommands/pbpaste.ts +5 -3
  91. package/lib/subcommands/privacy.ts +8 -5
  92. package/lib/subcommands/push.ts +4 -5
  93. package/lib/subcommands/shutdown.ts +3 -4
  94. package/lib/subcommands/spawn.ts +8 -9
  95. package/lib/subcommands/terminate.ts +2 -3
  96. package/lib/subcommands/ui.ts +7 -8
  97. package/lib/subcommands/uninstall.ts +2 -3
  98. package/lib/types.ts +1 -2
  99. package/package.json +6 -6
  100. package/build/index.d.ts +0 -5
  101. package/build/index.d.ts.map +0 -1
  102. package/build/index.js.map +0 -1
@@ -39,10 +39,10 @@ async function spawnSubProcess(args, env = {}) {
39
39
  if (lodash_1.default.isEmpty(args)) {
40
40
  throw new Error('Spawn arguments are required');
41
41
  }
42
- return await this.exec('spawn', {
42
+ return (await this.exec('spawn', {
43
43
  args: [this.requireUdid('spawn'), ...(lodash_1.default.isArray(args) ? args : [args])],
44
44
  env,
45
45
  asynchronous: true,
46
- });
46
+ }));
47
47
  }
48
48
  //# sourceMappingURL=spawn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../lib/subcomm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AC,CAIjF"}
1
+ {"version":3,"file":"terminate.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/terminate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhF"}
@@ -1 +1 @@
1
- {"version":3,"file":"terminate.js","sourceRoot":"","sources":["../../../lib/subcommands/terminate.ts"],"names":[],"mappings":";;AAYA,oCAIC;AAdD;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAAgB,QAAgB;IAChE,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"terminate.js","sourceRoot":"","sources":["../../../lib/subcommands/terminate.ts"],"names":[],"mappings":";;AAYA,oCAIC;AAdD;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAAe,QAAgB;IAC/D,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlE;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,M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AAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI9E"}
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":";;AAaA,8BAIC;AAfD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,SAAS,CAAgB,QAAgB;IAC7D,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":";;AAaA,8BAIC;AAfD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,SAAS,CAAe,QAAgB;IAC5D,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {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AAE,MAAM,CAAC;IACzB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB"}
package/lib/helpers.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as semver from 'semver';
2
- import { spawn } from 'node:child_process';
3
- import { Readable } from 'node:stream';
2
+ import {spawn} from 'node:child_process';
3
+ import {Readable} from 'node:stream';
4
4
 
5
5
  export const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
6
6
  export const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
@@ -13,7 +13,7 @@ export const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
13
13
  * @return The version in 'major.minor' form
14
14
  * @throws {Error} If the version not parseable by the `semver` package
15
15
  */
16
- export function normalizeVersion (version: string): string {
16
+ export function normalizeVersion(version: string): string {
17
17
  const semverVersion = semver.coerce(version);
18
18
  if (!semverVersion) {
19
19
  throw new Error(`Unable to parse version '${version}'`);
@@ -24,7 +24,7 @@ export function normalizeVersion (version: string): string {
24
24
  /**
25
25
  * @returns The xcrun binary name
26
26
  */
27
- export function getXcrunBinary (): string {
27
+ export function getXcrunBinary(): string {
28
28
  return process.env.XCRUN_BINARY || 'xcrun';
29
29
  }
30
30
 
@@ -33,7 +33,7 @@ export function getXcrunBinary (): string {
33
33
  *
34
34
  * @returns Promise resolving to UUID string
35
35
  */
36
- export async function uuidV4 (): Promise<string> {
36
+ export async function uuidV4(): Promise<string> {
37
37
  const uuidLib = await import('uuid');
38
38
  return uuidLib.v4();
39
39
  }
@@ -45,7 +45,7 @@ export async function uuidV4 (): Promise<string> {
45
45
  * @return Promise resolving to parsed JSON object
46
46
  * @throws {Error} If plutil fails to convert the input
47
47
  */
48
- export async function convertPlistToJson (plistInput: string): Promise<any> {
48
+ export async function convertPlistToJson(plistInput: string): Promise<any> {
49
49
  const plutilProcess = spawn('plutil', ['-convert', 'json', '-o', '-', '-']);
50
50
  let jsonOutput = '';
51
51
  plutilProcess.stdout.on('data', (chunk) => {
@@ -71,11 +71,12 @@ export async function convertPlistToJson (plistInput: string): Promise<any> {
71
71
  });
72
72
  } catch (err) {
73
73
  plutilProcess.kill(9);
74
- throw new Error(`Failed to convert plist to JSON: ${err instanceof Error ? err.message : String(err)}`);
74
+ throw new Error(
75
+ `Failed to convert plist to JSON: ${err instanceof Error ? err.message : String(err)}`,
76
+ );
75
77
  } finally {
76
78
  plutilProcess.removeAllListeners();
77
79
  inputStream.removeAllListeners();
78
80
  }
79
81
  return JSON.parse(jsonOutput);
80
82
  }
81
-
@@ -1,4 +1,4 @@
1
- import { Simctl } from './lib/simctl';
1
+ import {Simctl} from './simctl';
2
2
  export type {
3
3
  SimctlOpts,
4
4
  DeviceInfo,
@@ -7,7 +7,7 @@ export type {
7
7
  CertOptions,
8
8
  XCRun,
9
9
  AppInfo,
10
- } from './lib/types';
10
+ } from './types';
11
11
 
12
- export { Simctl };
12
+ export {Simctl};
13
13
  export default Simctl;
package/lib/logger.ts CHANGED
@@ -2,10 +2,10 @@ import appiumLogger from '@appium/logger';
2
2
 
3
3
  export const LOG_PREFIX = 'simctl';
4
4
 
5
- function getLogger () {
5
+ function getLogger() {
6
6
  const logger = global._global_npmlog || appiumLogger;
7
7
  if (!logger.debug) {
8
- logger.addLevel('debug', 1000, { fg: 'blue', bg: 'black' }, 'dbug');
8
+ logger.addLevel('debug', 1000, {fg: 'blue', bg: 'black'}, 'dbug');
9
9
  }
10
10
  return logger;
11
11
  }
package/lib/simctl.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import which from 'which';
3
- import { log, LOG_PREFIX } from './logger';
4
- import {
5
- DEFAULT_EXEC_TIMEOUT, getXcrunBinary,
6
- } from './helpers';
7
- import { exec as tpExec, SubProcess } from 'teen_process';
3
+ import {log, LOG_PREFIX} from './logger';
4
+ import {DEFAULT_EXEC_TIMEOUT, getXcrunBinary} from './helpers';
5
+ import {exec as tpExec, SubProcess} from 'teen_process';
8
6
  import * as addmediaCommands from './subcommands/addmedia';
9
7
  import * as appinfoCommands from './subcommands/appinfo';
10
8
  import * as bootCommands from './subcommands/boot';
@@ -30,9 +28,7 @@ import * as terminateCommands from './subcommands/terminate';
30
28
  import * as uiCommands from './subcommands/ui';
31
29
  import * as uninstallCommands from './subcommands/uninstall';
32
30
  import * as locationCommands from './subcommands/location';
33
- import type {
34
- XCRun, ExecOpts, SimctlOpts, ExecResult,
35
- } from './types';
31
+ import type {XCRun, ExecOpts, SimctlOpts, ExecResult} from './types';
36
32
 
37
33
  const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_';
38
34
 
@@ -43,27 +39,27 @@ export class Simctl {
43
39
  private _udid: string | null;
44
40
  private _devicesSetPath: string | null;
45
41
 
46
- constructor (opts: SimctlOpts = {}) {
47
- this.xcrun = _.cloneDeep(opts.xcrun ?? { path: null });
42
+ constructor(opts: SimctlOpts = {}) {
43
+ this.xcrun = _.cloneDeep(opts.xcrun ?? {path: null});
48
44
  this.execTimeout = opts.execTimeout ?? DEFAULT_EXEC_TIMEOUT;
49
45
  this.logErrors = opts.logErrors ?? true;
50
46
  this._udid = opts.udid ?? null;
51
47
  this._devicesSetPath = opts.devicesSetPath ?? null;
52
48
  }
53
49
 
54
- set udid (value: string | null) {
50
+ set udid(value: string | null) {
55
51
  this._udid = value;
56
52
  }
57
53
 
58
- get udid (): string | null {
54
+ get udid(): string | null {
59
55
  return this._udid;
60
56
  }
61
57
 
62
- set devicesSetPath (value: string | null) {
58
+ set devicesSetPath(value: string | null) {
63
59
  this._devicesSetPath = value;
64
60
  }
65
61
 
66
- get devicesSetPath (): string | null {
62
+ get devicesSetPath(): string | null {
67
63
  return this._devicesSetPath;
68
64
  }
69
65
 
@@ -72,10 +68,12 @@ export class Simctl {
72
68
  * @returns The UDID string
73
69
  * @throws {Error} If UDID is not set
74
70
  */
75
- requireUdid (commandName: string | null = null): string {
71
+ requireUdid(commandName: string | null = null): string {
76
72
  if (!this.udid) {
77
- throw new Error(`udid is required to be set for ` +
78
- (commandName ? `the '${commandName}' command` : 'this simctl command'));
73
+ throw new Error(
74
+ `udid is required to be set for ` +
75
+ (commandName ? `the '${commandName}' command` : 'this simctl command'),
76
+ );
79
77
  }
80
78
  return this.udid;
81
79
  }
@@ -83,15 +81,17 @@ export class Simctl {
83
81
  /**
84
82
  * @returns Promise resolving to the xcrun binary path
85
83
  */
86
- async requireXcrun (): Promise<string> {
84
+ async requireXcrun(): Promise<string> {
87
85
  const xcrunBinary = getXcrunBinary();
88
86
 
89
87
  if (!this.xcrun.path) {
90
88
  try {
91
89
  this.xcrun.path = await which(xcrunBinary);
92
90
  } catch {
93
- throw new Error(`${xcrunBinary} tool has not been found in PATH. ` +
94
- `Are Xcode developers tools installed?`);
91
+ throw new Error(
92
+ `${xcrunBinary} tool has not been found in PATH. ` +
93
+ `Are Xcode developers tools installed?`,
94
+ );
95
95
  }
96
96
  }
97
97
  if (!this.xcrun.path) {
@@ -110,10 +110,7 @@ export class Simctl {
110
110
  * `SubProcess` instance depending of `opts.asynchronous` value.
111
111
  * @throws {Error} If the simctl subcommand command returns non-zero return code.
112
112
  */
113
- async exec<T extends ExecOpts> (
114
- subcommand: string,
115
- opts?: T
116
- ): Promise<ExecResult<T>> {
113
+ async exec<T extends ExecOpts>(subcommand: string, opts?: T): Promise<ExecResult<T>> {
117
114
  const {
118
115
  args: initialArgs = [],
119
116
  env: initialEnv = {},
@@ -122,20 +119,21 @@ export class Simctl {
122
119
  logErrors = true,
123
120
  architectures,
124
121
  timeout,
125
- } = opts ?? {} as T;
122
+ } = opts ?? ({} as T);
126
123
  // run a particular simctl command
127
124
  const args = [
128
125
  'simctl',
129
126
  ...(this.devicesSetPath ? ['--set', this.devicesSetPath] : []),
130
127
  subcommand,
131
- ...initialArgs
128
+ ...initialArgs,
132
129
  ];
133
130
  // Prefix all passed in environment variables with 'SIMCTL_CHILD_', simctl
134
131
  // will then pass these to the child (spawned) process.
135
132
  const env = _.defaults(
136
- _.mapKeys(initialEnv,
137
- (value, key) => _.startsWith(key, SIMCTL_ENV_PREFIX) ? key : `${SIMCTL_ENV_PREFIX}${key}`),
138
- process.env
133
+ _.mapKeys(initialEnv, (value, key) =>
134
+ _.startsWith(key, SIMCTL_ENV_PREFIX) ? key : `${SIMCTL_ENV_PREFIX}${key}`,
135
+ ),
136
+ process.env,
139
137
  );
140
138
 
141
139
  const execOpts: any = {
@@ -150,14 +148,19 @@ export class Simctl {
150
148
  let execArgs: [string, string[], any];
151
149
  if (architectures?.length) {
152
150
  const archArgs = _.flatMap(
153
- (_.isArray(architectures) ? architectures : [architectures]).map((arch) => ['-arch', arch])
151
+ (_.isArray(architectures) ? architectures : [architectures]).map((arch) => [
152
+ '-arch',
153
+ arch,
154
+ ]),
154
155
  );
155
156
  execArgs = ['arch', [...archArgs, xcrun, ...args], execOpts];
156
157
  } else {
157
158
  execArgs = [xcrun, args, execOpts];
158
159
  }
159
160
  // We know what we are doing here - the type system can't handle the dynamic nature
160
- return (asynchronous ? new SubProcess(...execArgs) : await tpExec(...execArgs)) as ExecResult<T>;
161
+ return (
162
+ asynchronous ? new SubProcess(...execArgs) : await tpExec(...execArgs)
163
+ ) as ExecResult<T>;
161
164
  } catch (e: any) {
162
165
  if (!this.logErrors || !logErrors) {
163
166
  // if we don't want to see the errors, just throw and allow the calling
@@ -218,4 +221,3 @@ export class Simctl {
218
221
  }
219
222
 
220
223
  export default Simctl;
221
-
@@ -1,5 +1,5 @@
1
- import type { Simctl } from '../simctl';
2
- import type { TeenProcessExecResult } from 'teen_process';
1
+ import type {Simctl} from '../simctl';
2
+ import type {TeenProcessExecResult} from 'teen_process';
3
3
 
4
4
  /**
5
5
  * Add the particular media file to Simulator's library.
@@ -12,7 +12,10 @@ import type { TeenProcessExecResult } from 'teen_process';
12
12
  * returns non-zero return code.
13
13
  * @throws {Error} If the `udid` instance property is unset
14
14
  */
15
- export async function addMedia (this: Simctl, filePath: string): Promise<TeenProcessExecResult<string>> {
15
+ export async function addMedia(
16
+ this: Simctl,
17
+ filePath: string,
18
+ ): Promise<TeenProcessExecResult<string>> {
16
19
  return await this.exec('addmedia', {
17
20
  args: [this.requireUdid('addmedia'), filePath],
18
21
  });
@@ -1,6 +1,6 @@
1
- import type { Simctl } from '../simctl';
2
- import type { AppInfo } from '../types';
3
- import { convertPlistToJson } from '../helpers';
1
+ import type {Simctl} from '../simctl';
2
+ import type {AppInfo} from '../types';
3
+ import {convertPlistToJson} from '../helpers';
4
4
  import _ from 'lodash';
5
5
 
6
6
  /**
@@ -13,7 +13,7 @@ import _ from 'lodash';
13
13
  * returns non-zero return code.
14
14
  * @throws {Error} If the `udid` instance property is unset
15
15
  */
16
- export async function appInfo (this: Simctl, bundleId: string): Promise<AppInfo> {
16
+ export async function appInfo(this: Simctl, bundleId: string): Promise<AppInfo> {
17
17
  const {stdout} = await this.exec('appinfo', {
18
18
  args: [this.requireUdid('appinfo'), bundleId],
19
19
  });
@@ -26,7 +26,7 @@ export async function appInfo (this: Simctl, bundleId: string): Promise<AppInfo>
26
26
  result = await convertPlistToJson(stdout);
27
27
  } catch (err) {
28
28
  throw new Error(
29
- `Cannot retrieve app info for ${bundleId}: ${err instanceof Error ? err.message : String(err)}`
29
+ `Cannot retrieve app info for ${bundleId}: ${err instanceof Error ? err.message : String(err)}`,
30
30
  );
31
31
  }
32
32
  }
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import { log, LOG_PREFIX } from '../logger';
3
- import type { Simctl } from '../simctl';
2
+ import {log, LOG_PREFIX} from '../logger';
3
+ import type {Simctl} from '../simctl';
4
4
 
5
5
  /**
6
6
  * Boot the particular Simulator if it is not running.
@@ -9,10 +9,10 @@ import type { Simctl } from '../simctl';
9
9
  * returns non-zero return code.
10
10
  * @throws {Error} If the `udid` instance property is unset
11
11
  */
12
- export async function bootDevice (this: Simctl): Promise<void> {
12
+ export async function bootDevice(this: Simctl): Promise<void> {
13
13
  try {
14
14
  await this.exec('boot', {
15
- args: [this.requireUdid('boot')]
15
+ args: [this.requireUdid('boot')],
16
16
  });
17
17
  } catch (e: any) {
18
18
  if (_.includes(e.message, 'Unable to boot device in current state: Booted')) {
@@ -1,9 +1,9 @@
1
- import { log } from '../logger';
2
- import { waitForCondition } from 'asyncbox';
1
+ import {log} from '../logger';
2
+ import {waitForCondition} from 'asyncbox';
3
3
  import _ from 'lodash';
4
- import type { Simctl } from '../simctl';
5
- import type { BootMonitorOptions } from '../types';
6
- import type { SubProcess } from 'teen_process';
4
+ import type {Simctl} from '../simctl';
5
+ import type {BootMonitorOptions} from '../types';
6
+ import type {SubProcess} from 'teen_process';
7
7
 
8
8
  /**
9
9
  * Start monitoring for boot status of the particular Simulator.
@@ -17,92 +17,94 @@ import type { SubProcess } from 'teen_process';
17
17
  * property is not set.
18
18
  * @throws {Error} If the `udid` instance property is unset
19
19
  */
20
- export async function startBootMonitor (
20
+ export async function startBootMonitor(
21
21
  this: Simctl,
22
- opts: BootMonitorOptions = {}
22
+ opts: BootMonitorOptions = {},
23
23
  ): Promise<SubProcess> {
24
- const {
25
- timeout = 240000,
26
- onWaitingDataMigration,
27
- onWaitingSystemApp,
28
- onFinished,
29
- onError,
30
- shouldPreboot,
31
- } = opts;
32
- const udid = this.requireUdid('bootstatus');
24
+ const {
25
+ timeout = 240000,
26
+ onWaitingDataMigration,
27
+ onWaitingSystemApp,
28
+ onFinished,
29
+ onError,
30
+ shouldPreboot,
31
+ } = opts;
32
+ const udid = this.requireUdid('bootstatus');
33
33
 
34
- const status: string[] = [];
35
- let isBootingFinished = false;
36
- let error: Error | null = null;
37
- let timeoutHandler: NodeJS.Timeout | null = null;
38
- const args = [udid];
39
- if (shouldPreboot) {
40
- args.push('-b');
34
+ const status: string[] = [];
35
+ let isBootingFinished = false;
36
+ let error: Error | null = null;
37
+ let timeoutHandler: NodeJS.Timeout | null = null;
38
+ const args = [udid];
39
+ if (shouldPreboot) {
40
+ args.push('-b');
41
+ }
42
+ const bootMonitor = await this.exec('bootstatus', {
43
+ args,
44
+ asynchronous: true,
45
+ });
46
+ const onStreamLine = (line: string) => {
47
+ status.push(line);
48
+ if (onWaitingDataMigration && line.includes('Waiting on Data Migration')) {
49
+ onWaitingDataMigration();
50
+ } else if (onWaitingSystemApp && line.includes('Waiting on System App')) {
51
+ onWaitingSystemApp();
41
52
  }
42
- const bootMonitor = await this.exec('bootstatus', {
43
- args,
44
- asynchronous: true,
45
- });
46
- const onStreamLine = (line: string) => {
47
- status.push(line);
48
- if (onWaitingDataMigration && line.includes('Waiting on Data Migration')) {
49
- onWaitingDataMigration();
50
- } else if (onWaitingSystemApp && line.includes('Waiting on System App')) {
51
- onWaitingSystemApp();
52
- }
53
- };
54
- for (const streamName of ['stdout', 'stderr']) {
55
- bootMonitor.on(`line-${streamName}`, onStreamLine);
53
+ };
54
+ for (const streamName of ['stdout', 'stderr']) {
55
+ bootMonitor.on(`line-${streamName}`, onStreamLine);
56
+ }
57
+ bootMonitor.once('exit', (code, signal) => {
58
+ if (timeoutHandler) {
59
+ clearTimeout(timeoutHandler);
56
60
  }
57
- bootMonitor.once('exit', (code, signal) => {
58
- if (timeoutHandler) {
59
- clearTimeout(timeoutHandler);
60
- }
61
- if (code === 0) {
62
- if (onFinished) {
63
- onFinished();
64
- }
65
- isBootingFinished = true;
66
- } else {
67
- const errMessage = _.isEmpty(status)
68
- ? `The simulator booting process has exited with code ${code} by signal ${signal}`
69
- : status.join('\n');
70
- error = new Error(errMessage);
71
- if (onError) {
72
- onError(error);
73
- }
74
- }
75
- });
76
- await bootMonitor.start(0);
77
- const stopMonitor = async () => {
78
- if (bootMonitor.isRunning) {
79
- try {
80
- await bootMonitor.stop();
81
- } catch (e: any) {
82
- log.warn(e.message);
83
- }
61
+ if (code === 0) {
62
+ if (onFinished) {
63
+ onFinished();
84
64
  }
85
- };
86
- const start = process.hrtime();
87
- if (onFinished) {
88
- timeoutHandler = setTimeout(stopMonitor, timeout);
65
+ isBootingFinished = true;
89
66
  } else {
67
+ const errMessage = _.isEmpty(status)
68
+ ? `The simulator booting process has exited with code ${code} by signal ${signal}`
69
+ : status.join('\n');
70
+ error = new Error(errMessage);
71
+ if (onError) {
72
+ onError(error);
73
+ }
74
+ }
75
+ });
76
+ await bootMonitor.start(0);
77
+ const stopMonitor = async () => {
78
+ if (bootMonitor.isRunning) {
90
79
  try {
91
- await waitForCondition(() => {
80
+ await bootMonitor.stop();
81
+ } catch (e: any) {
82
+ log.warn(e.message);
83
+ }
84
+ }
85
+ };
86
+ const start = process.hrtime();
87
+ if (onFinished) {
88
+ timeoutHandler = setTimeout(stopMonitor, timeout);
89
+ } else {
90
+ try {
91
+ await waitForCondition(
92
+ () => {
92
93
  if (error) {
93
94
  throw error;
94
95
  }
95
96
  return isBootingFinished;
96
- }, {waitMs: timeout, intervalMs: 500});
97
- } catch {
98
- await stopMonitor();
99
- const [seconds] = process.hrtime(start);
100
- throw new Error(
101
- `The simulator ${udid} has failed to finish booting after ${seconds}s. ` +
102
- `Original status: ${status.join('\n')}`
103
- );
104
- }
97
+ },
98
+ {waitMs: timeout, intervalMs: 500},
99
+ );
100
+ } catch {
101
+ await stopMonitor();
102
+ const [seconds] = process.hrtime(start);
103
+ throw new Error(
104
+ `The simulator ${udid} has failed to finish booting after ${seconds}s. ` +
105
+ `Original status: ${status.join('\n')}`,
106
+ );
105
107
  }
106
- return bootMonitor;
108
+ }
109
+ return bootMonitor;
107
110
  }
108
-