node-simctl 8.1.4 → 8.1.6

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 (96) 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/logger.js.map +1 -1
  5. package/build/lib/simctl.d.ts.map +1 -1
  6. package/build/lib/simctl.js +5 -2
  7. package/build/lib/simctl.js.map +1 -1
  8. package/build/lib/subcommands/addmedia.d.ts.map +1 -1
  9. package/build/lib/subcommands/addmedia.js.map +1 -1
  10. package/build/lib/subcommands/appinfo.d.ts.map +1 -1
  11. package/build/lib/subcommands/appinfo.js.map +1 -1
  12. package/build/lib/subcommands/boot.d.ts.map +1 -1
  13. package/build/lib/subcommands/boot.js +1 -1
  14. package/build/lib/subcommands/boot.js.map +1 -1
  15. package/build/lib/subcommands/bootstatus.d.ts.map +1 -1
  16. package/build/lib/subcommands/bootstatus.js.map +1 -1
  17. package/build/lib/subcommands/create.d.ts.map +1 -1
  18. package/build/lib/subcommands/create.js +2 -2
  19. package/build/lib/subcommands/create.js.map +1 -1
  20. package/build/lib/subcommands/delete.d.ts.map +1 -1
  21. package/build/lib/subcommands/delete.js +1 -1
  22. package/build/lib/subcommands/erase.d.ts.map +1 -1
  23. package/build/lib/subcommands/erase.js +1 -1
  24. package/build/lib/subcommands/erase.js.map +1 -1
  25. package/build/lib/subcommands/get_app_container.d.ts.map +1 -1
  26. package/build/lib/subcommands/getenv.d.ts.map +1 -1
  27. package/build/lib/subcommands/getenv.js.map +1 -1
  28. package/build/lib/subcommands/install.d.ts.map +1 -1
  29. package/build/lib/subcommands/install.js.map +1 -1
  30. package/build/lib/subcommands/io.d.ts.map +1 -1
  31. package/build/lib/subcommands/io.js +4 -4
  32. package/build/lib/subcommands/io.js.map +1 -1
  33. package/build/lib/subcommands/keychain.d.ts.map +1 -1
  34. package/build/lib/subcommands/keychain.js +6 -6
  35. package/build/lib/subcommands/keychain.js.map +1 -1
  36. package/build/lib/subcommands/launch.d.ts.map +1 -1
  37. package/build/lib/subcommands/launch.js.map +1 -1
  38. package/build/lib/subcommands/list.d.ts.map +1 -1
  39. package/build/lib/subcommands/list.js +4 -3
  40. package/build/lib/subcommands/list.js.map +1 -1
  41. package/build/lib/subcommands/location.d.ts.map +1 -1
  42. package/build/lib/subcommands/location.js.map +1 -1
  43. package/build/lib/subcommands/openurl.d.ts.map +1 -1
  44. package/build/lib/subcommands/openurl.js.map +1 -1
  45. package/build/lib/subcommands/pbcopy.d.ts.map +1 -1
  46. package/build/lib/subcommands/pbcopy.js +2 -2
  47. package/build/lib/subcommands/pbcopy.js.map +1 -1
  48. package/build/lib/subcommands/pbpaste.d.ts.map +1 -1
  49. package/build/lib/subcommands/pbpaste.js.map +1 -1
  50. package/build/lib/subcommands/privacy.d.ts.map +1 -1
  51. package/build/lib/subcommands/privacy.js.map +1 -1
  52. package/build/lib/subcommands/push.d.ts.map +1 -1
  53. package/build/lib/subcommands/push.js +4 -4
  54. package/build/lib/subcommands/push.js.map +1 -1
  55. package/build/lib/subcommands/shutdown.d.ts.map +1 -1
  56. package/build/lib/subcommands/shutdown.js.map +1 -1
  57. package/build/lib/subcommands/spawn.d.ts.map +1 -1
  58. package/build/lib/subcommands/spawn.js +2 -2
  59. package/build/lib/subcommands/spawn.js.map +1 -1
  60. package/build/lib/subcommands/terminate.d.ts.map +1 -1
  61. package/build/lib/subcommands/terminate.js.map +1 -1
  62. package/build/lib/subcommands/ui.d.ts.map +1 -1
  63. package/build/lib/subcommands/ui.js.map +1 -1
  64. package/build/lib/subcommands/uninstall.d.ts.map +1 -1
  65. package/build/lib/subcommands/uninstall.js.map +1 -1
  66. package/build/lib/types.d.ts.map +1 -1
  67. package/lib/helpers.ts +9 -8
  68. package/lib/logger.ts +2 -2
  69. package/lib/simctl.ts +34 -32
  70. package/lib/subcommands/addmedia.ts +6 -3
  71. package/lib/subcommands/appinfo.ts +5 -5
  72. package/lib/subcommands/boot.ts +4 -4
  73. package/lib/subcommands/bootstatus.ts +82 -80
  74. package/lib/subcommands/create.ts +22 -20
  75. package/lib/subcommands/delete.ts +3 -4
  76. package/lib/subcommands/erase.ts +10 -8
  77. package/lib/subcommands/get_app_container.ts +3 -4
  78. package/lib/subcommands/getenv.ts +2 -3
  79. package/lib/subcommands/install.ts +2 -3
  80. package/lib/subcommands/io.ts +7 -8
  81. package/lib/subcommands/keychain.ts +24 -27
  82. package/lib/subcommands/launch.ts +7 -4
  83. package/lib/subcommands/list.ts +48 -38
  84. package/lib/subcommands/location.ts +5 -6
  85. package/lib/subcommands/openurl.ts +3 -3
  86. package/lib/subcommands/pbcopy.ts +6 -7
  87. package/lib/subcommands/pbpaste.ts +5 -3
  88. package/lib/subcommands/privacy.ts +8 -5
  89. package/lib/subcommands/push.ts +7 -8
  90. package/lib/subcommands/shutdown.ts +3 -4
  91. package/lib/subcommands/spawn.ts +8 -9
  92. package/lib/subcommands/terminate.ts +2 -3
  93. package/lib/subcommands/ui.ts +7 -8
  94. package/lib/subcommands/uninstall.ts +2 -3
  95. package/lib/types.ts +1 -2
  96. package/package.json +4 -2
@@ -1,4 +1,4 @@
1
- import type { Simctl } from '../simctl';
1
+ import type {Simctl} from '../simctl';
2
2
 
3
3
  /**
4
4
  * Grants the given permission on the app with the given bundle identifier
@@ -24,7 +24,7 @@ import type { Simctl } from '../simctl';
24
24
  * or there was an error while granting the permission
25
25
  * @throws {Error} If the `udid` instance property is unset
26
26
  */
27
- export async function grantPermission (this: Simctl, bundleId: string, perm: string): Promise<void> {
27
+ export async function grantPermission(this: Simctl, bundleId: string, perm: string): Promise<void> {
28
28
  await this.exec('privacy', {
29
29
  args: [this.requireUdid('privacy grant'), 'grant', perm, bundleId],
30
30
  });
@@ -42,7 +42,11 @@ export async function grantPermission (this: Simctl, bundleId: string, perm: str
42
42
  * or there was an error while revoking the permission
43
43
  * @throws {Error} If the `udid` instance property is unset
44
44
  */
45
- export async function revokePermission (this: Simctl, bundleId: string, perm: string): Promise<void> {
45
+ export async function revokePermission(
46
+ this: Simctl,
47
+ bundleId: string,
48
+ perm: string,
49
+ ): Promise<void> {
46
50
  await this.exec('privacy', {
47
51
  args: [this.requireUdid('privacy revoke'), 'revoke', perm, bundleId],
48
52
  });
@@ -60,9 +64,8 @@ export async function revokePermission (this: Simctl, bundleId: string, perm: st
60
64
  * or there was an error while resetting the permission
61
65
  * @throws {Error} If the `udid` instance property is unset
62
66
  */
63
- export async function resetPermission (this: Simctl, bundleId: string, perm: string): Promise<void> {
67
+ export async function resetPermission(this: Simctl, bundleId: string, perm: string): Promise<void> {
64
68
  await this.exec('privacy', {
65
69
  args: [this.requireUdid('private reset'), 'reset', perm, bundleId],
66
70
  });
67
71
  }
68
-
@@ -1,9 +1,9 @@
1
- import { rimraf } from 'rimraf';
2
- import { uuidV4 } from '../helpers';
3
- import path from 'path';
4
- import os from 'os';
5
- import fs from 'fs/promises';
6
- import type { Simctl } from '../simctl';
1
+ import {rimraf} from 'rimraf';
2
+ import {uuidV4} from '../helpers';
3
+ import path from 'node:path';
4
+ import os from 'node:os';
5
+ import fs from 'node:fs/promises';
6
+ import type {Simctl} from '../simctl';
7
7
 
8
8
  /**
9
9
  * Send a simulated push notification
@@ -25,7 +25,7 @@ import type { Simctl } from '../simctl';
25
25
  * or there was an error while pushing the notification
26
26
  * @throws {Error} If the `udid` instance property is unset
27
27
  */
28
- export async function pushNotification (this: Simctl, payload: Record<string, any>): Promise<void> {
28
+ export async function pushNotification(this: Simctl, payload: Record<string, any>): Promise<void> {
29
29
  const dstPath = path.resolve(os.tmpdir(), `${await uuidV4()}.json`);
30
30
  try {
31
31
  await fs.writeFile(dstPath, JSON.stringify(payload), 'utf8');
@@ -36,4 +36,3 @@ export async function pushNotification (this: Simctl, payload: Record<string, an
36
36
  await rimraf(dstPath);
37
37
  }
38
38
  }
39
-
@@ -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
  * Shutdown the given Simulator if it is running.
@@ -9,7 +9,7 @@ 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 shutdownDevice (this: Simctl): Promise<void> {
12
+ export async function shutdownDevice(this: Simctl): Promise<void> {
13
13
  try {
14
14
  await this.exec('shutdown', {
15
15
  args: [this.requireUdid('shutdown')],
@@ -21,4 +21,3 @@ export async function shutdownDevice (this: Simctl): Promise<void> {
21
21
  log.debug(LOG_PREFIX, `Simulator already in 'Shutdown' state. Continuing`);
22
22
  }
23
23
  }
24
-
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import type { Simctl } from '../simctl';
3
- import type { TeenProcessExecResult, SubProcess } from 'teen_process';
2
+ import type {Simctl} from '../simctl';
3
+ import type {TeenProcessExecResult, SubProcess} from 'teen_process';
4
4
 
5
5
  /**
6
6
  * Spawn the particular process on Simulator.
@@ -13,10 +13,10 @@ import type { TeenProcessExecResult, SubProcess } from 'teen_process';
13
13
  * returns non-zero return code.
14
14
  * @throws {Error} If the `udid` instance property is unset
15
15
  */
16
- export async function spawnProcess (
16
+ export async function spawnProcess(
17
17
  this: Simctl,
18
18
  args: string | string[],
19
- env: Record<string, any> = {}
19
+ env: Record<string, any> = {},
20
20
  ): Promise<TeenProcessExecResult<string>> {
21
21
  if (_.isEmpty(args)) {
22
22
  throw new Error('Spawn arguments are required');
@@ -37,19 +37,18 @@ export async function spawnProcess (
37
37
  * @return The instance of the process to be spawned.
38
38
  * @throws {Error} If the `udid` instance property is unset
39
39
  */
40
- export async function spawnSubProcess (
40
+ export async function spawnSubProcess(
41
41
  this: Simctl,
42
42
  args: string | string[],
43
- env: Record<string, any> = {}
43
+ env: Record<string, any> = {},
44
44
  ): Promise<SubProcess> {
45
45
  if (_.isEmpty(args)) {
46
46
  throw new Error('Spawn arguments are required');
47
47
  }
48
48
 
49
- return await this.exec('spawn', {
49
+ return (await this.exec('spawn', {
50
50
  args: [this.requireUdid('spawn'), ...(_.isArray(args) ? args : [args])],
51
51
  env,
52
52
  asynchronous: true,
53
- }) as SubProcess;
53
+ })) as SubProcess;
54
54
  }
55
-
@@ -1,4 +1,4 @@
1
- import type { Simctl } from '../simctl';
1
+ import type {Simctl} from '../simctl';
2
2
 
3
3
  /**
4
4
  * Terminate the given running application on Simulator.
@@ -10,9 +10,8 @@ import type { Simctl } from '../simctl';
10
10
  * returns non-zero return code.
11
11
  * @throws {Error} If the `udid` instance property is unset
12
12
  */
13
- export async function terminateApp (this: Simctl, bundleId: string): Promise<void> {
13
+ export async function terminateApp(this: Simctl, bundleId: string): Promise<void> {
14
14
  await this.exec('terminate', {
15
15
  args: [this.requireUdid('terminate'), bundleId],
16
16
  });
17
17
  }
18
-
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import type { Simctl } from '../simctl';
2
+ import type {Simctl} from '../simctl';
3
3
 
4
4
  /**
5
5
  * Retrieves the current UI appearance value from the given simulator
@@ -10,7 +10,7 @@ import type { Simctl } from '../simctl';
10
10
  * or there was an error while getting the value
11
11
  * @throws {Error} If the `udid` instance property is unset
12
12
  */
13
- export async function getAppearance (this: Simctl): Promise<string> {
13
+ export async function getAppearance(this: Simctl): Promise<string> {
14
14
  const {stdout} = await this.exec('ui', {
15
15
  args: [this.requireUdid('ui'), 'appearance'],
16
16
  });
@@ -26,7 +26,7 @@ export async function getAppearance (this: Simctl): Promise<string> {
26
26
  * or there was an error while getting the value
27
27
  * @throws {Error} If the `udid` instance property is unset
28
28
  */
29
- export async function setAppearance (this: Simctl, appearance: string): Promise<void> {
29
+ export async function setAppearance(this: Simctl, appearance: string): Promise<void> {
30
30
  await this.exec('ui', {
31
31
  args: [this.requireUdid('ui'), 'appearance', appearance],
32
32
  });
@@ -48,7 +48,7 @@ export async function setAppearance (this: Simctl, appearance: string): Promise<
48
48
  * or there was an error while getting the value.
49
49
  * @throws {Error} If the `udid` instance property is unset
50
50
  */
51
- export async function getIncreaseContrast (this: Simctl): Promise<string> {
51
+ export async function getIncreaseContrast(this: Simctl): Promise<string> {
52
52
  const {stdout} = await this.exec('ui', {
53
53
  args: [this.requireUdid('ui'), 'increase_contrast'],
54
54
  });
@@ -68,7 +68,7 @@ export async function getIncreaseContrast (this: Simctl): Promise<string> {
68
68
  * or the given value was invalid for the command.
69
69
  * @throws {Error} If the `udid` instance property is unset
70
70
  */
71
- export async function setIncreaseContrast (this: Simctl, increaseContrast: string): Promise<void> {
71
+ export async function setIncreaseContrast(this: Simctl, increaseContrast: string): Promise<void> {
72
72
  await this.exec('ui', {
73
73
  args: [this.requireUdid('ui'), 'increase_contrast', increaseContrast],
74
74
  });
@@ -95,7 +95,7 @@ export async function setIncreaseContrast (this: Simctl, increaseContrast: strin
95
95
  * or there was an error while getting the value.
96
96
  * @throws {Error} If the `udid` instance property is unset
97
97
  */
98
- export async function getContentSize (this: Simctl): Promise<string> {
98
+ export async function getContentSize(this: Simctl): Promise<string> {
99
99
  const {stdout} = await this.exec('ui', {
100
100
  args: [this.requireUdid('ui'), 'content_size'],
101
101
  });
@@ -124,9 +124,8 @@ export async function getContentSize (this: Simctl): Promise<string> {
124
124
  * or the given value was invalid for the command.
125
125
  * @throws {Error} If the `udid` instance property is unset
126
126
  */
127
- export async function setContentSize (this: Simctl, contentSizeAction: string): Promise<void> {
127
+ export async function setContentSize(this: Simctl, contentSizeAction: string): Promise<void> {
128
128
  await this.exec('ui', {
129
129
  args: [this.requireUdid('ui'), 'content_size', contentSizeAction],
130
130
  });
131
131
  }
132
-
@@ -1,4 +1,4 @@
1
- import type { Simctl } from '../simctl';
1
+ import type {Simctl} from '../simctl';
2
2
 
3
3
  /**
4
4
  * Remove the particular application package from Simulator.
@@ -11,9 +11,8 @@ import type { Simctl } from '../simctl';
11
11
  * returns non-zero return code.
12
12
  * @throws {Error} If the `udid` instance property is unset
13
13
  */
14
- export async function removeApp (this: Simctl, bundleId: string): Promise<void> {
14
+ export async function removeApp(this: Simctl, bundleId: string): Promise<void> {
15
15
  await this.exec('uninstall', {
16
16
  args: [this.requireUdid('uninstall'), bundleId],
17
17
  });
18
18
  }
19
-
package/lib/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SubProcess, TeenProcessExecResult } from 'teen_process';
1
+ import type {SubProcess, TeenProcessExecResult} from 'teen_process';
2
2
 
3
3
  /**
4
4
  * XCRun configuration
@@ -240,4 +240,3 @@ export interface AppInfo {
240
240
  */
241
241
  SBAppTags?: string[];
242
242
  }
243
-
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "ios",
7
7
  "simctl"
8
8
  ],
9
- "version": "8.1.4",
9
+ "version": "8.1.6",
10
10
  "author": "Appium Contributors",
11
11
  "license": "Apache-2.0",
12
12
  "repository": {
@@ -50,6 +50,8 @@
50
50
  "dev": "npm run build -- --watch",
51
51
  "lint": "eslint .",
52
52
  "lint:fix": "npm run lint -- --fix",
53
+ "format": "prettier -w ./lib ./test",
54
+ "format:check": "prettier --check ./lib ./test",
53
55
  "prepare": "npm run build",
54
56
  "test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.ts\"",
55
57
  "e2e-test": "mocha --exit --timeout 5m \"./test/e2e/**/*-specs.ts\""
@@ -60,7 +62,7 @@
60
62
  "singleQuote": true
61
63
  },
62
64
  "devDependencies": {
63
- "@appium/eslint-config-appium-ts": "^2.0.0-rc.1",
65
+ "@appium/eslint-config-appium-ts": "^3.0.0",
64
66
  "@appium/tsconfig": "^1.0.0-rc.1",
65
67
  "@appium/types": "^1.0.0-rc.1",
66
68
  "@semantic-release/changelog": "^6.0.1",