@wdio/appium-service 7.20.8-alpha.219 → 7.23.0

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.
package/build/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import AppiumLauncher from './launcher.js';
1
+ import AppiumLauncher from './launcher';
2
2
  export default class AppiumService {
3
3
  }
4
4
  export declare const launcher: typeof AppiumLauncher;
5
- export * from './types.js';
6
- import type { AppiumServiceConfig } from './types';
5
+ export * from './types';
6
+ import { AppiumServiceConfig } from './types';
7
7
  declare global {
8
8
  namespace WebdriverIO {
9
9
  interface ServiceOption extends AppiumServiceConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,eAAe,CAAA;AAE1C,MAAM,CAAC,OAAO,OAAO,aAAa;CAAG;AACrC,eAAO,MAAM,QAAQ,uBAAiB,CAAA;AAEtC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,aAAc,SAAQ,mBAAmB;SAAG;KACzD;CACJ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,YAAY,CAAA;AAEvC,MAAM,CAAC,OAAO,OAAO,aAAa;CAAG;AACrC,eAAO,MAAM,QAAQ,uBAAiB,CAAA;AAEtC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,aAAc,SAAQ,mBAAmB;SAAG;KACzD;CACJ"}
package/build/index.js CHANGED
@@ -1,6 +1,27 @@
1
+ "use strict";
1
2
  /* istanbul ignore file */
2
- import AppiumLauncher from './launcher.js';
3
- export default class AppiumService {
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.launcher = void 0;
22
+ const launcher_1 = __importDefault(require("./launcher"));
23
+ class AppiumService {
4
24
  }
5
- export const launcher = AppiumLauncher;
6
- export * from './types.js';
25
+ exports.default = AppiumService;
26
+ exports.launcher = launcher_1.default;
27
+ __exportStar(require("./types"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAmBzE,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;IAQ/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IATpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,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C,MAAM,CAAC,iBAAiB;CAanC"}
package/build/launcher.js CHANGED
@@ -1,10 +1,15 @@
1
- import { spawn } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import { createRequire } from 'node:module';
4
- import logger from '@wdio/logger';
5
- import { isCloudCapability } from '@wdio/config';
6
- import { getFilePath, formatCliArgs } from './utils.js';
7
- const log = logger('@wdio/appium-service');
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const logger_1 = __importDefault(require("@wdio/logger"));
7
+ const child_process_1 = require("child_process");
8
+ const fs_extra_1 = require("fs-extra");
9
+ const util_1 = require("util");
10
+ const config_1 = require("@wdio/config");
11
+ const utils_1 = require("./utils");
12
+ const log = (0, logger_1.default)('@wdio/appium-service');
8
13
  const DEFAULT_LOG_FILENAME = 'wdio-appium.log';
9
14
  const DEFAULT_CONNECTION = {
10
15
  protocol: 'http',
@@ -12,14 +17,9 @@ const DEFAULT_CONNECTION = {
12
17
  port: 4723,
13
18
  path: '/'
14
19
  };
15
- const require = createRequire(import.meta.url);
16
- /**
17
- * 'fs-extra' has no support for ESM
18
- * https://github.com/jprichardson/node-fs-extra/issues/746
19
- */
20
- const { createWriteStream, ensureFileSync } = require('fs-extra');
21
- export default class AppiumLauncher {
20
+ class AppiumLauncher {
22
21
  constructor(_options, _capabilities, _config) {
22
+ var _a;
23
23
  this._options = _options;
24
24
  this._capabilities = _capabilities;
25
25
  this._config = _config;
@@ -28,7 +28,7 @@ export default class AppiumLauncher {
28
28
  basePath: DEFAULT_CONNECTION.path,
29
29
  ...(this._options.args || {})
30
30
  };
31
- this._logPath = _options.logPath || this._config?.outputDir;
31
+ this._logPath = _options.logPath || ((_a = this._config) === null || _a === void 0 ? void 0 : _a.outputDir);
32
32
  this._command = this._getCommand(_options.command);
33
33
  }
34
34
  _getCommand(command) {
@@ -61,22 +61,22 @@ export default class AppiumLauncher {
61
61
  for (const [, capability] of Object.entries(this._capabilities)) {
62
62
  const cap = capability.capabilities || capability;
63
63
  const c = cap.alwaysMatch || cap;
64
- !isCloudCapability(c) && Object.assign(capability, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...capability });
64
+ !(0, config_1.isCloudCapability)(c) && Object.assign(capability, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...capability });
65
65
  }
66
66
  return;
67
67
  }
68
- this._capabilities.forEach((cap) => !isCloudCapability(cap.alwaysMatch || cap) && Object.assign(cap, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...cap }));
68
+ this._capabilities.forEach((cap) => !(0, config_1.isCloudCapability)(cap.alwaysMatch || cap) && Object.assign(cap, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...cap }));
69
69
  }
70
70
  async onPrepare() {
71
71
  /**
72
72
  * Append remaining arguments
73
73
  */
74
- this._appiumCliArgs.push(...formatCliArgs(this._args));
74
+ this._appiumCliArgs.push(...(0, utils_1.formatCliArgs)(this._args));
75
75
  this._setCapabilities();
76
76
  /**
77
77
  * start Appium
78
78
  */
79
- this._process = await promisify(this._startAppium)(this._command, this._appiumCliArgs);
79
+ this._process = await (0, util_1.promisify)(this._startAppium)(this._command, this._appiumCliArgs);
80
80
  if (this._logPath) {
81
81
  this._redirectLogStream(this._logPath);
82
82
  }
@@ -89,7 +89,7 @@ export default class AppiumLauncher {
89
89
  }
90
90
  _startAppium(command, args, callback) {
91
91
  log.debug(`Will spawn Appium process: ${command} ${args.join(' ')}`);
92
- let process = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
92
+ let process = (0, child_process_1.spawn)(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
93
93
  let error;
94
94
  process.stdout.on('data', (data) => {
95
95
  if (data.includes('Appium REST http interface listener started')) {
@@ -114,11 +114,11 @@ export default class AppiumLauncher {
114
114
  if (!this._process) {
115
115
  throw Error('No Appium process to redirect log stream');
116
116
  }
117
- const logFile = getFilePath(logPath, DEFAULT_LOG_FILENAME);
117
+ const logFile = (0, utils_1.getFilePath)(logPath, DEFAULT_LOG_FILENAME);
118
118
  // ensure file & directory exists
119
- ensureFileSync(logFile);
119
+ (0, fs_extra_1.ensureFileSync)(logFile);
120
120
  log.debug(`Appium logs written to: ${logFile}`);
121
- const logStream = createWriteStream(logFile, { flags: 'w' });
121
+ const logStream = (0, fs_extra_1.createWriteStream)(logFile, { flags: 'w' });
122
122
  this._process.stdout.pipe(logStream);
123
123
  this._process.stderr.pipe(logStream);
124
124
  }
@@ -135,3 +135,4 @@ export default class AppiumLauncher {
135
135
  }
136
136
  }
137
137
  }
138
+ exports.default = AppiumLauncher;
package/build/types.js CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/build/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ArgValue, KeyValueArgs } from './types';
1
+ import { ArgValue, KeyValueArgs } from './types';
2
2
  /**
3
3
  * Resolves the given path into a absolute path and appends the default filename as fallback when the provided path is a directory.
4
4
  * @param {String} filePath relative file or directory path
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIrD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAoBvE;AAED,wBAAgB,sBAAsB,CAAE,KAAK,EAAE,QAAQ,UAItD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIhD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAU9E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAoBvE;AAED,wBAAgB,sBAAsB,CAAE,KAAK,EAAE,QAAQ,UAItD;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
package/build/utils.js CHANGED
@@ -1,5 +1,8 @@
1
- import { basename, join, resolve } from 'node:path';
2
- import { paramCase } from 'param-case';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWindows = exports.sanitizeCliOptionValue = exports.formatCliArgs = exports.getFilePath = void 0;
4
+ const path_1 = require("path");
5
+ const param_case_1 = require("param-case");
3
6
  const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
4
7
  /**
5
8
  * Resolves the given path into a absolute path and appends the default filename as fallback when the provided path is a directory.
@@ -7,16 +10,17 @@ const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
7
10
  * @param {String} defaultFilename default file name when filePath is a directory
8
11
  * @return {String} absolute file path
9
12
  */
10
- export function getFilePath(filePath, defaultFilename) {
11
- let absolutePath = resolve(filePath);
13
+ function getFilePath(filePath, defaultFilename) {
14
+ let absolutePath = (0, path_1.resolve)(filePath);
12
15
  // test if we already have a file (e.g. selenium.txt, .log, log.txt, etc.)
13
16
  // NOTE: path.extname doesn't work to detect a file, cause dotfiles are reported by node to have no extension
14
- if (!FILE_EXTENSION_REGEX.test(basename(absolutePath))) {
15
- absolutePath = join(absolutePath, defaultFilename);
17
+ if (!FILE_EXTENSION_REGEX.test((0, path_1.basename)(absolutePath))) {
18
+ absolutePath = (0, path_1.join)(absolutePath, defaultFilename);
16
19
  }
17
20
  return absolutePath;
18
21
  }
19
- export function formatCliArgs(args) {
22
+ exports.getFilePath = getFilePath;
23
+ function formatCliArgs(args) {
20
24
  if (Array.isArray(args)) {
21
25
  return args.map(arg => sanitizeCliOptionValue(arg));
22
26
  }
@@ -27,7 +31,7 @@ export function formatCliArgs(args) {
27
31
  if ((typeof value === 'boolean' && !value) || value === null) {
28
32
  continue;
29
33
  }
30
- cliArgs.push(`--${paramCase(key)}`);
34
+ cliArgs.push(`--${(0, param_case_1.paramCase)(key)}`);
31
35
  // Only non-boolean and non-null values are added as option values
32
36
  if (typeof value !== 'boolean') {
33
37
  cliArgs.push(sanitizeCliOptionValue(value));
@@ -35,11 +39,14 @@ export function formatCliArgs(args) {
35
39
  }
36
40
  return cliArgs;
37
41
  }
38
- export function sanitizeCliOptionValue(value) {
42
+ exports.formatCliArgs = formatCliArgs;
43
+ function sanitizeCliOptionValue(value) {
39
44
  const valueString = String(value);
40
45
  // Encapsulate the value string in single quotes if it contains a white space
41
46
  return /\s/.test(valueString) ? `'${valueString}'` : valueString;
42
47
  }
43
- export function isWindows() {
48
+ exports.sanitizeCliOptionValue = sanitizeCliOptionValue;
49
+ function isWindows() {
44
50
  return process.platform === 'win32';
45
51
  }
52
+ exports.isWindows = isWindows;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@wdio/appium-service",
3
- "version": "7.20.8-alpha.219+4aab2cef1",
3
+ "version": "7.23.0",
4
4
  "description": "A WebdriverIO service to start & stop Appium Server",
5
5
  "author": "Morten Bjerg Gregersen <morten@mogee.dk>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-appium-service",
7
7
  "license": "MIT",
8
+ "main": "./build/index",
8
9
  "engines": {
9
- "node": "^16.13 || >=18"
10
+ "node": ">=12.0.0"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
@@ -24,23 +25,20 @@
24
25
  "bugs": {
25
26
  "url": "https://github.com/webdriverio/webdriverio/issues"
26
27
  },
27
- "type": "module",
28
- "exports": "./build/index.js",
29
- "types": "./build/index.d.ts",
30
- "typeScriptVersion": "3.8.3",
31
28
  "dependencies": {
32
- "@types/fs-extra": "^9.0.13",
33
- "@wdio/config": "7.20.7",
29
+ "@types/fs-extra": "^9.0.4",
30
+ "@wdio/config": "7.23.0",
34
31
  "@wdio/logger": "7.19.0",
35
- "@wdio/types": "7.20.7",
36
- "fs-extra": "^10.1.0",
37
- "param-case": "^3.0.4"
32
+ "@wdio/types": "7.23.0",
33
+ "fs-extra": "^10.0.0",
34
+ "param-case": "^3.0.0"
38
35
  },
39
36
  "peerDependencies": {
40
- "@wdio/cli": "next"
37
+ "@wdio/cli": "^7.0.0"
41
38
  },
42
39
  "publishConfig": {
43
40
  "access": "public"
44
41
  },
45
- "gitHead": "4aab2cef1b8b195ac8cc611f28b1fd54e4ba3443"
42
+ "types": "./build/index.d.ts",
43
+ "gitHead": "00407ba4e1b414c38195789c748bbad69df1b26d"
46
44
  }