appium 2.0.0-beta.20 → 2.0.0-beta.24

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 (90) hide show
  1. package/README.md +1 -2
  2. package/build/check-npm-pack-files.js +23 -0
  3. package/build/commands-yml/parse.js +319 -0
  4. package/build/commands-yml/validator.js +130 -0
  5. package/build/index.js +19 -0
  6. package/build/lib/appium.js +22 -7
  7. package/build/lib/cli/args.js +13 -15
  8. package/build/lib/cli/npm.js +27 -16
  9. package/build/lib/cli/parser.js +7 -3
  10. package/build/lib/config.js +27 -47
  11. package/build/lib/extension-config.js +1 -1
  12. package/build/lib/main.js +29 -28
  13. package/build/lib/plugin-config.js +2 -2
  14. package/build/lib/plugins.js +4 -2
  15. package/build/lib/schema/appium-config-schema.js +3 -2
  16. package/build/lib/schema/arg-spec.js +5 -3
  17. package/build/lib/schema/cli-args.js +25 -16
  18. package/build/lib/schema/keywords.js +14 -4
  19. package/build/lib/schema/schema.js +80 -9
  20. package/build/lib/utils.js +16 -36
  21. package/build/postinstall.js +90 -0
  22. package/build/test/cli/cli-e2e-specs.js +221 -0
  23. package/build/test/cli/cli-helpers.js +86 -0
  24. package/build/test/cli/cli-specs.js +71 -0
  25. package/build/test/cli/fixtures/test-driver/package.json +27 -0
  26. package/build/test/cli/schema-args-specs.js +48 -0
  27. package/build/test/cli/schema-e2e-specs.js +47 -0
  28. package/build/test/config-e2e-specs.js +112 -0
  29. package/build/test/config-file-e2e-specs.js +209 -0
  30. package/build/test/config-file-specs.js +281 -0
  31. package/build/test/config-specs.js +246 -0
  32. package/build/test/driver-e2e-specs.js +435 -0
  33. package/build/test/driver-specs.js +386 -0
  34. package/build/test/ext-config-io-specs.js +181 -0
  35. package/build/test/extension-config-specs.js +365 -0
  36. package/build/test/fixtures/allow-feat.txt +5 -0
  37. package/build/test/fixtures/caps.json +3 -0
  38. package/build/test/fixtures/config/allow-insecure.txt +3 -0
  39. package/build/test/fixtures/config/appium.config.bad-nodeconfig.json +5 -0
  40. package/build/test/fixtures/config/appium.config.bad.json +32 -0
  41. package/build/test/fixtures/config/appium.config.ext-good.json +9 -0
  42. package/build/test/fixtures/config/appium.config.ext-unknown-props.json +10 -0
  43. package/build/test/fixtures/config/appium.config.good.js +40 -0
  44. package/build/test/fixtures/config/appium.config.good.json +33 -0
  45. package/build/test/fixtures/config/appium.config.good.yaml +30 -0
  46. package/build/test/fixtures/config/appium.config.invalid.json +31 -0
  47. package/build/test/fixtures/config/appium.config.security-array.json +5 -0
  48. package/build/test/fixtures/config/appium.config.security-delimited.json +5 -0
  49. package/build/test/fixtures/config/appium.config.security-path.json +5 -0
  50. package/build/test/fixtures/config/driver-fake.config.json +8 -0
  51. package/build/test/fixtures/config/nodeconfig.json +3 -0
  52. package/build/test/fixtures/config/plugin-fake.config.json +0 -0
  53. package/build/test/fixtures/default-args.js +35 -0
  54. package/build/test/fixtures/deny-feat.txt +5 -0
  55. package/build/test/fixtures/driver.schema.js +20 -0
  56. package/build/test/fixtures/extensions.yaml +27 -0
  57. package/build/test/fixtures/flattened-schema.js +532 -0
  58. package/build/test/fixtures/plugin.schema.js +20 -0
  59. package/build/test/fixtures/schema-with-extensions.js +28 -0
  60. package/build/test/grid-register-specs.js +74 -0
  61. package/build/test/helpers.js +75 -0
  62. package/build/test/logger-specs.js +76 -0
  63. package/build/test/npm-specs.js +20 -0
  64. package/build/test/parser-specs.js +319 -0
  65. package/build/test/plugin-e2e-specs.js +316 -0
  66. package/build/test/schema/arg-spec-specs.js +70 -0
  67. package/build/test/schema/cli-args-specs.js +408 -0
  68. package/build/test/schema/schema-specs.js +407 -0
  69. package/build/test/utils-specs.js +288 -0
  70. package/index.js +11 -0
  71. package/lib/appium-config.schema.json +2 -1
  72. package/lib/appium.js +51 -8
  73. package/lib/cli/args.js +17 -14
  74. package/lib/cli/npm.js +68 -6
  75. package/lib/cli/parser.js +5 -2
  76. package/lib/config.js +72 -54
  77. package/lib/extension-config.js +1 -1
  78. package/lib/main.js +93 -40
  79. package/lib/plugin-config.js +1 -1
  80. package/lib/plugins.js +2 -0
  81. package/lib/schema/appium-config-schema.js +1 -0
  82. package/lib/schema/arg-spec.js +12 -2
  83. package/lib/schema/cli-args.js +22 -34
  84. package/lib/schema/keywords.js +20 -4
  85. package/lib/schema/schema.js +142 -22
  86. package/lib/utils.js +28 -29
  87. package/package.json +10 -14
  88. package/types/types.d.ts +5 -0
  89. package/build/lib/cli/argparse-actions.js +0 -104
  90. package/lib/cli/argparse-actions.js +0 -77
@@ -79,26 +79,36 @@ function getSchemaValidator ({ref: schemaId}, coerce = _.identity) {
79
79
  };
80
80
  }
81
81
 
82
+ /**
83
+ * Determine the description for display on the CLI, given the schema.
84
+ * @param {AppiumJSONSchema} schema
85
+ * @returns {string}
86
+ */
87
+ function makeDescription (schema) {
88
+ const {appiumCliDescription, description = '', appiumDeprecated} = schema;
89
+ let desc = appiumCliDescription ?? description;
90
+ if (appiumDeprecated) {
91
+ desc = `[DEPRECATED] ${desc}`;
92
+ }
93
+ return desc;
94
+ }
95
+
82
96
  /**
83
97
  * Given arg `name`, a JSON schema `subSchema`, and options, return an argument definition
84
98
  * as understood by `argparse`.
85
99
  * @param {AppiumJSONSchema} subSchema - JSON schema for the option
86
100
  * @param {ArgSpec} argSpec - Argument spec tuple
87
- * @param {SubSchemaToArgDefOptions} [opts] - Options
88
101
  * @returns {[string[], import('argparse').ArgumentOptions]} Tuple of flag and options
89
102
  */
90
- function subSchemaToArgDef (subSchema, argSpec, opts = {}) {
91
- const {overrides = {}} = opts;
103
+ function subSchemaToArgDef (subSchema, argSpec) {
92
104
  let {
93
105
  type,
94
106
  appiumCliAliases,
95
107
  appiumCliTransformer,
96
- appiumCliDescription,
97
- description,
98
108
  enum: enumValues,
99
109
  } = subSchema;
100
110
 
101
- const {name, arg, dest} = argSpec;
111
+ const {name, arg} = argSpec;
102
112
 
103
113
  const aliases = [
104
114
  aliasToFlag(argSpec),
@@ -110,7 +120,7 @@ function subSchemaToArgDef (subSchema, argSpec, opts = {}) {
110
120
  /** @type {import('argparse').ArgumentOptions} */
111
121
  let argOpts = {
112
122
  required: false,
113
- help: appiumCliDescription ?? description,
123
+ help: makeDescription(subSchema)
114
124
  };
115
125
 
116
126
  /**
@@ -130,7 +140,8 @@ function subSchemaToArgDef (subSchema, argSpec, opts = {}) {
130
140
  switch (type) {
131
141
  // booleans do not have a type per `ArgumentOptions`, just an "action"
132
142
  case TYPENAMES.BOOLEAN: {
133
- argOpts.action = 'store_true';
143
+ argOpts.action = 'store_const';
144
+ argOpts.const = true;
134
145
  break;
135
146
  }
136
147
 
@@ -215,16 +226,6 @@ function subSchemaToArgDef (subSchema, argSpec, opts = {}) {
215
226
  }
216
227
  }
217
228
 
218
- // overrides override anything we computed here. usually this involves "custom types",
219
- // which are really just transform functions.
220
- argOpts = _.merge(
221
- argOpts,
222
- /** should the override keys correspond to the prop name or the prop dest?
223
- * the prop dest is computed by {@link aliasToDest}.
224
- */
225
- overrides[dest] ?? {},
226
- );
227
-
228
229
  return [aliases, argOpts];
229
230
  }
230
231
 
@@ -232,32 +233,19 @@ function subSchemaToArgDef (subSchema, argSpec, opts = {}) {
232
233
  * Converts the finalized, flattened schema representation into
233
234
  * ArgumentDefinitions for handoff to `argparse`.
234
235
  *
235
- * @param {ToParserArgsOptions} opts - Options
236
236
  * @throws If schema has not been added to ajv (via `finalizeSchema()`)
237
237
  * @returns {import('../cli/args').ArgumentDefinitions} A map of arryas of
238
238
  * aliases to `argparse` arguments; empty if no schema found
239
239
  */
240
- export function toParserArgs (opts = {}) {
241
- const flattened = flattenSchema();
240
+ export function toParserArgs () {
241
+ const flattened = flattenSchema().filter(({schema}) => !schema.appiumCliIgnored);
242
242
  return new Map(
243
243
  _.map(flattened, ({schema, argSpec}) =>
244
- subSchemaToArgDef(schema, argSpec, opts),
244
+ subSchemaToArgDef(schema, argSpec),
245
245
  ),
246
246
  );
247
247
  }
248
248
 
249
- /**
250
- * Options for {@link toParserArgs}
251
- * @typedef {SubSchemaToArgDefOptions} ToParserArgsOptions
252
- */
253
-
254
- /**
255
- * Options for {@link subSchemaToArgDef}.
256
- * @typedef {Object} SubSchemaToArgDefOptions
257
- * @property {string} [prefix] - The prefix to use for the flag, if any
258
- * @property {{[key: string]: import('argparse').ArgumentOptions}} [overrides] - An object of key/value pairs to override the default values
259
- */
260
-
261
249
  /**
262
250
  * @template T
263
251
  * @typedef {import('ajv/dist/types').FormatValidator<T>} FormatValidator<T>
@@ -86,11 +86,26 @@ export const keywords = {
86
86
  * Flag to tell Appium to _not_ provide this property as a CLI argument.
87
87
  * @type {KeywordDefinition}
88
88
  */
89
- appiumCliIgnore: {
90
- keyword: 'appiumCliIgnore',
89
+ appiumCliIgnored: {
90
+ keyword: 'appiumCliIgnored',
91
91
  metaSchema: {
92
92
  type: 'boolean',
93
- description: 'If `true`, Appium will not provide this property as a CLI argument.'
93
+ description: 'If `true`, Appium will not provide this property as a CLI argument. This is NOT the same as a "hidden" argument.',
94
+ enum: [true]
95
+ }
96
+ },
97
+
98
+ /**
99
+ * Mark this property as deprecated.
100
+ * @type {KeywordDefinition}
101
+ */
102
+ appiumDeprecated: {
103
+ keyword: 'appiumDeprecated',
104
+ metaSchema: {
105
+ type: 'boolean',
106
+ description: 'If `true`, this property will be displayed as "deprecated" to the user',
107
+ enum: [true],
108
+ $comment: 'JSON schema draft-2019-09 keyword `deprecated` serves the same purpose. This keyword should itself be deprecated if we move to draft-2019-09!'
94
109
  }
95
110
  }
96
111
  };
@@ -109,8 +124,9 @@ export const keywords = {
109
124
  * @property {string} [appiumCliDest]
110
125
  * @property {string} [appiumCliDescription]
111
126
  * @property {string[]} [appiumCliAliases]
112
- * @property {boolean} [appiumCliIgnore]
127
+ * @property {boolean} [appiumCliIgnored]
113
128
  * @property {AppiumCliTransformerName} [appiumCliTransformer]
129
+ * @property {boolean} [appiumDeprecated]
114
130
  */
115
131
 
116
132
 
@@ -4,11 +4,11 @@ import Ajv from 'ajv';
4
4
  import addFormats from 'ajv-formats';
5
5
  import _ from 'lodash';
6
6
  import path from 'path';
7
- import {DRIVER_TYPE, PLUGIN_TYPE} from '../extension-config';
8
- import {ReadonlyMap} from '../utils';
7
+ import { DRIVER_TYPE, PLUGIN_TYPE } from '../extension-config';
8
+ import { ReadonlyMap } from '../utils';
9
9
  import appiumConfigSchema from './appium-config-schema';
10
- import {ArgSpec, SERVER_PROP_NAME, APPIUM_CONFIG_SCHEMA_ID} from './arg-spec';
11
- import {keywords} from './keywords';
10
+ import { APPIUM_CONFIG_SCHEMA_ID, ArgSpec, SERVER_PROP_NAME } from './arg-spec';
11
+ import { keywords } from './keywords';
12
12
 
13
13
  /**
14
14
  * Extensions that an extension schema file can have.
@@ -91,6 +91,7 @@ class AppiumSchema {
91
91
  'flatten',
92
92
  'getArgSpec',
93
93
  'getDefaults',
94
+ 'getDefaultsForExtension',
94
95
  'getSchema',
95
96
  'hasArgSpec',
96
97
  'isFinalized',
@@ -152,7 +153,7 @@ class AppiumSchema {
152
153
  const ajv = this._ajv;
153
154
 
154
155
  // Ajv will _mutate_ the schema, so we need to clone it.
155
- const baseSchema = _.cloneDeep(/** @type {StrictSchemaObject} */(appiumConfigSchema));
156
+ const baseSchema = _.cloneDeep(appiumConfigSchema);
156
157
 
157
158
  /**
158
159
  *
@@ -202,7 +203,7 @@ class AppiumSchema {
202
203
  ajv.validateSchema(schema, true);
203
204
  addArgSpecs(schema.properties, extType, extName);
204
205
  ajv.addSchema(schema, $ref);
205
- finalizedSchemas[$ref] = /** @type {StrictSchemaObject} */(schema);
206
+ finalizedSchemas[$ref] = /** @type {StrictSchemaObject} */ (schema);
206
207
  });
207
208
  return baseSchema;
208
209
  },
@@ -277,12 +278,14 @@ class AppiumSchema {
277
278
  * @returns {void}
278
279
  */
279
280
  registerSchema (extType, extName, schema) {
280
- if (!(extType && extName && !_.isEmpty(schema))) {
281
+ if (!(extType && extName) || _.isUndefined(schema)) {
281
282
  throw new TypeError(
282
- 'Expected nonempty extension type, extension name and schema parameters',
283
+ 'Expected extension type, extension name, and a defined schema',
283
284
  );
284
285
  }
285
-
286
+ if (!AppiumSchema.isSupportedSchemaType(schema)) {
287
+ throw new SchemaUnsupportedSchemaError(schema, extType, extName);
288
+ }
286
289
  const normalizedExtName = _.kebabCase(extName);
287
290
  if (this.hasRegisteredSchema(extType, normalizedExtName)) {
288
291
  if (this._registeredSchemas[extType].get(normalizedExtName) === schema) {
@@ -320,22 +323,67 @@ class AppiumSchema {
320
323
  /**
321
324
  * Returns a `Record` of argument "dest" strings to default values.
322
325
  *
323
- * The "dest" string is the property name in object returned by `argparse.ArgumentParser['parse_args']`.
324
- * @returns {Record<string,ArgSpec['defaultValue']>}
326
+ * The "dest" string is the property name in object returned by
327
+ * `argparse.ArgumentParser['parse_args']`.
328
+ * @template {boolean|undefined} Flattened
329
+ * @param {Flattened} [flatten=true] - If `true`, flattens the returned object
330
+ * using "keypath"-style keys of the format `<extType>.<extName>.<argName>`.
331
+ * Otherwise, returns a nested object using `extType` and `extName` as
332
+ * properties. Base arguments (server arguments) are always at the top level.
333
+ * @returns {DefaultValues<Flattened>}
325
334
  */
326
- getDefaults () {
335
+ getDefaults (flatten = /** @type {Flattened} */ (true)) {
327
336
  if (!this.isFinalized()) {
328
337
  throw new SchemaFinalizationError();
329
338
  }
330
- return [...this._argSpecs.values()].reduce(
331
- (defaults, {defaultValue, dest}) => {
339
+
340
+ /**
341
+ * @private
342
+ * @callback DefaultReducer
343
+ * @param {DefaultValues<Flattened>} defaults
344
+ * @param {ArgSpec} argSpec
345
+ * @returns {DefaultValues<Flattened>}
346
+ */
347
+ /** @type {DefaultReducer} */
348
+ const reducer = flatten
349
+ ? (defaults, {defaultValue, dest}) => {
332
350
  if (!_.isUndefined(defaultValue)) {
333
351
  defaults[dest] = defaultValue;
334
352
  }
335
353
  return defaults;
336
- },
337
- {},
354
+ }
355
+ : (defaults, {defaultValue, dest}) => {
356
+ if (!_.isUndefined(defaultValue)) {
357
+ _.set(defaults, dest, defaultValue);
358
+ }
359
+ return defaults;
360
+ };
361
+
362
+ /** @type {DefaultValues<Flattened>} */
363
+ const retval = {};
364
+ return [...this._argSpecs.values()].reduce(reducer, retval);
365
+ }
366
+
367
+ /**
368
+ * Returns a flattened Record of defaults for a specific extension. Keys will
369
+ * be of format `<argName>`.
370
+ * @param {ExtensionType} extType - Extension type
371
+ * @param {string} extName - Extension name
372
+ * @returns {Record<string,ArgSpecDefaultValue>}
373
+ */
374
+ getDefaultsForExtension (extType, extName) {
375
+ if (!this.isFinalized()) {
376
+ throw new SchemaFinalizationError();
377
+ }
378
+ const specs = [...this._argSpecs.values()].filter(
379
+ (spec) => spec.extType === extType && spec.extName === extName,
338
380
  );
381
+ return specs.reduce((defaults, {defaultValue, rawDest}) => {
382
+ if (!_.isUndefined(defaultValue)) {
383
+ defaults[rawDest] = defaultValue;
384
+ }
385
+ return defaults;
386
+ }, {});
339
387
  }
340
388
 
341
389
  /**
@@ -416,7 +464,7 @@ class AppiumSchema {
416
464
  * Retrieves the schema itself
417
465
  * @public
418
466
  * @param {string} [ref] - Schema ID
419
- * @throws If the schema has not yet been _finalized_
467
+ * @throws If the schema has not yet been finalized
420
468
  * @returns {SchemaObject}
421
469
  */
422
470
  getSchema (ref = APPIUM_CONFIG_SCHEMA_ID) {
@@ -450,9 +498,7 @@ class AppiumSchema {
450
498
  * @returns {import('ajv').ErrorObject[]} Array of errors, if any.
451
499
  */
452
500
  validate (value, ref = APPIUM_CONFIG_SCHEMA_ID) {
453
- const validator = /** @type {import('ajv').ValidateFunction} */ (
454
- this._getValidator(ref)
455
- );
501
+ const validator = this._getValidator(ref);
456
502
  return !validator(value) && _.isArray(validator.errors)
457
503
  ? [...validator.errors]
458
504
  : [];
@@ -466,6 +512,15 @@ class AppiumSchema {
466
512
  static isAllowedSchemaFileExtension (filename) {
467
513
  return ALLOWED_SCHEMA_EXTENSIONS.has(path.extname(filename));
468
514
  }
515
+
516
+ /**
517
+ * Returns `true` if `schema` is a plain object with a non-true `$async` property.
518
+ * @param {any} schema - Schema to check
519
+ * @returns {schema is SchemaObject}
520
+ */
521
+ static isSupportedSchemaType (schema) {
522
+ return _.isPlainObject(schema) && schema.$async !== true;
523
+ }
469
524
  }
470
525
 
471
526
  /**
@@ -534,6 +589,54 @@ export class SchemaUnknownSchemaError extends ReferenceError {
534
589
  }
535
590
  }
536
591
 
592
+ /**
593
+ * Thrown when a schema is provided, but it's of an unsupported type.
594
+ *
595
+ * "Valid" schemas which are unsupported include boolean schemas and async schemas
596
+ * (having a `true` `$async` property).
597
+ */
598
+ export class SchemaUnsupportedSchemaError extends TypeError {
599
+ /**
600
+ * @type {Readonly<string>}
601
+ */
602
+ code = 'APPIUMERR_SCHEMA_UNSUPPORTED_SCHEMA';
603
+
604
+ /**
605
+ * @type {Readonly<{schema: any, extType: ExtensionType, extName: string}>}
606
+ */
607
+ data;
608
+
609
+ /**
610
+ * @param {any} schema
611
+ * @param {ExtensionType} extType
612
+ * @param {string} extName
613
+ */
614
+ constructor (schema, extType, extName) {
615
+ // https://github.com/Microsoft/TypeScript/issues/8277
616
+ super(
617
+ (() => {
618
+ let msg = `Unsupported schema from ${extType} "${extName}":`;
619
+ if (_.isBoolean(schema)) {
620
+ return `${msg} schema cannot be a boolean`;
621
+ }
622
+ if (_.isPlainObject(schema)) {
623
+ if (schema.$async) {
624
+ return `${msg} schema cannot be an async schema`;
625
+ }
626
+ /* istanbul ignore next */
627
+ throw new TypeError(
628
+ `schema IS supported; this error should not be thrown (this is a bug). value of schema: ${JSON.stringify(
629
+ schema,
630
+ )}`,
631
+ );
632
+ }
633
+ return `${msg} schema must be a plain object without a true "$async" property`;
634
+ })(),
635
+ );
636
+ this.data = {schema, extType, extName};
637
+ }
638
+ }
639
+
537
640
  const appiumSchema = AppiumSchema.create();
538
641
 
539
642
  export const {
@@ -546,12 +649,14 @@ export const {
546
649
  validate,
547
650
  getSchema,
548
651
  flatten: flattenSchema,
549
- getDefaults: getDefaultsFromSchema,
652
+ getDefaults: getDefaultsForSchema,
653
+ getDefaultsForExtension,
550
654
  } = appiumSchema;
551
655
  export const {isAllowedSchemaFileExtension} = AppiumSchema;
552
656
 
553
657
  /**
554
- * @typedef {import('ajv').SchemaObject} SchemaObject
658
+ * Appium only supports schemas that are plain objects; not arrays.
659
+ * @typedef {import('ajv').SchemaObject & {[key: number]: never}} SchemaObject
555
660
  */
556
661
 
557
662
  /**
@@ -575,3 +680,18 @@ export const {isAllowedSchemaFileExtension} = AppiumSchema;
575
680
  * Intermediate data structure used when converting the entire schema down to CLI arguments.
576
681
  * @typedef {{schema: SchemaObject, argSpec: ArgSpec}[]} FlattenedSchema
577
682
  */
683
+
684
+ /**
685
+ * @typedef {ArgSpec['defaultValue']} ArgSpecDefaultValue
686
+ */
687
+
688
+ /**
689
+ * e.g. `{driver: {foo: 'bar'}}` where `foo` is the arg name and `bar` is the default value.
690
+ * @typedef {Record<string,Record<string,ArgSpecDefaultValue>>} NestedArgSpecDefaultValue
691
+ */
692
+
693
+ /**
694
+ * Helper type for the return value of {@link AppiumSchema.getDefaults}
695
+ * @template {boolean|undefined} Flattened
696
+ * @typedef {Record<string,Flattened extends true ? ArgSpecDefaultValue : ArgSpecDefaultValue | NestedArgSpecDefaultValue>} DefaultValues
697
+ */
package/lib/utils.js CHANGED
@@ -1,37 +1,36 @@
1
+ // @ts-check
2
+
1
3
  import _ from 'lodash';
2
4
  import logger from './logger';
5
+ // @ts-ignore
3
6
  import { processCapabilities, PROTOCOLS } from '@appium/base-driver';
4
7
  import { fs } from '@appium/support';
8
+ import { inspect as dump } from 'util';
5
9
 
6
10
  const W3C_APPIUM_PREFIX = 'appium';
7
11
 
8
- function inspectObject (args) {
9
- function getValueArray (obj, indent = ' ') {
10
- if (!_.isObject(obj)) {
11
- return [obj];
12
- }
12
+ /**
13
+ *
14
+ * If `stdout` is a TTY, this is `true`.
15
+ *
16
+ * Used for tighter control over log output.
17
+ * @type {boolean}
18
+ */
19
+ const isStdoutTTY = process.stdout.isTTY;
13
20
 
14
- let strArr = ['{'];
15
- for (let [arg, value] of _.toPairs(obj)) {
16
- if (!_.isObject(value)) {
17
- strArr.push(`${indent} ${arg}: ${value}`);
18
- } else {
19
- value = getValueArray(value, `${indent} `);
20
- strArr.push(`${indent} ${arg}: ${value.shift()}`);
21
- strArr.push(...value);
22
- }
23
- }
24
- strArr.push(`${indent}}`);
25
- return strArr;
26
- }
27
- for (let [arg, value] of _.toPairs(args)) {
28
- value = getValueArray(value);
29
- logger.info(` ${arg}: ${value.shift()}`);
30
- for (let val of value) {
31
- logger.info(val);
32
- }
33
- }
34
- }
21
+ /**
22
+ * Dumps to value to the console using `info` logger.
23
+ *
24
+ * @todo May want to force color to be `false` if {@link isStdoutTTY} is `false`.
25
+ */
26
+ const inspect = _.flow(
27
+ _.partialRight(
28
+ /** @type {(object: any, options: import('util').InspectOptions) => string} */(dump),
29
+ {colors: true, depth: null, compact: !isStdoutTTY}
30
+ ),
31
+ (...args) => {
32
+ logger.info(...args);
33
+ });
35
34
 
36
35
  /**
37
36
  * Takes the caps that were provided in the request and translates them
@@ -236,8 +235,8 @@ class ReadonlyMap extends Map {
236
235
  return super.set(key, value);
237
236
  }
238
237
 
239
- delete (key) {
240
- throw new Error(`${key} cannot be deleted`);
238
+ delete () {
239
+ return false;
241
240
  }
242
241
 
243
242
  clear () {
@@ -246,6 +245,6 @@ class ReadonlyMap extends Map {
246
245
  }
247
246
 
248
247
  export {
249
- inspectObject, parseCapsForInnerDriver, insertAppiumPrefixes, rootDir,
248
+ inspect, parseCapsForInnerDriver, insertAppiumPrefixes, rootDir,
250
249
  getPackageVersion, pullSettings, removeAppiumPrefixes, ReadonlyMap
251
250
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium",
3
- "version": "2.0.0-beta.20",
3
+ "version": "2.0.0-beta.24",
4
4
  "description": "Automation for Apps.",
5
5
  "keywords": [
6
6
  "automation",
@@ -21,9 +21,8 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "author": "https://github.com/appium",
24
- "main": "./build/lib/main.js",
25
24
  "bin": {
26
- "appium": "./build/lib/main.js"
25
+ "appium": "index.js"
27
26
  },
28
27
  "directories": {
29
28
  "lib": "./lib"
@@ -31,25 +30,25 @@
31
30
  "files": [
32
31
  "bin",
33
32
  "lib",
34
- "build/lib",
33
+ "build",
34
+ "index.js",
35
35
  "postinstall.js",
36
36
  "types"
37
37
  ],
38
38
  "scripts": {
39
39
  "generate-docs": "gulp transpile && node ./build/commands-yml/parse.js",
40
40
  "postinstall": "node ./postinstall.js",
41
- "install-fake-driver": "node . driver install --source=local ../fake-driver",
42
41
  "upload": "gulp github-upload",
43
42
  "zip": "zip -qr appium.zip .",
44
43
  "zip-and-upload": "npm run zip && npm run upload"
45
44
  },
46
45
  "dependencies": {
47
- "@appium/base-driver": "^8.2.0",
46
+ "@appium/base-driver": "^8.2.3",
48
47
  "@appium/base-plugin": "1.8.0",
49
- "@appium/support": "^2.55.1",
48
+ "@appium/support": "^2.55.3",
50
49
  "@babel/runtime": "7.16.3",
51
50
  "@sidvind/better-ajv-errors": "0.9.2",
52
- "ajv": "8.8.0",
51
+ "ajv": "8.8.2",
53
52
  "ajv-formats": "2.1.1",
54
53
  "argparse": "2.0.1",
55
54
  "async-lock": "1.3.0",
@@ -63,17 +62,14 @@
63
62
  "longjohn": "0.2.12",
64
63
  "npmlog": "5.0.1",
65
64
  "ora": "5.4.1",
65
+ "resolve-from": "5.0.0",
66
66
  "semver": "7.3.5",
67
- "source-map-support": "0.5.20",
67
+ "source-map-support": "0.5.21",
68
68
  "teen_process": "1.16.0",
69
69
  "winston": "3.3.3",
70
70
  "word-wrap": "1.2.3",
71
71
  "yaml": "1.10.2"
72
72
  },
73
- "devDependencies": {
74
- "@appium/fake-driver": "^3.2.0",
75
- "@appium/gulp-plugins": "^5.5.5"
76
- },
77
73
  "engines": {
78
74
  "node": ">=12",
79
75
  "npm": ">=6"
@@ -83,5 +79,5 @@
83
79
  "tag": "next"
84
80
  },
85
81
  "homepage": "https://appium.io",
86
- "gitHead": "d7882a15eeca9992c5310b53811855f9ccaae36b"
82
+ "gitHead": "ca90a11813546ab4851e5b1f0406f420a53227e6"
87
83
  }
package/types/types.d.ts CHANGED
@@ -160,6 +160,11 @@ interface MoreArgs {
160
160
  /**
161
161
  * If true, show the build info and exit
162
162
  */
163
+ showBuildInfo: boolean;
164
+
165
+ /**
166
+ * If true, show config and exit
167
+ */
163
168
  showConfig: boolean;
164
169
 
165
170
  /**