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

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';
1
+ import AppiumLauncher from './launcher.js';
2
2
  export default class AppiumService {
3
3
  }
4
4
  export declare const launcher: typeof AppiumLauncher;
5
- export * from './types';
6
- import { AppiumServiceConfig } from './types';
5
+ export * from './types.js';
6
+ import type { 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,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"}
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"}
package/build/index.js CHANGED
@@ -1,27 +1,6 @@
1
- "use strict";
2
1
  /* istanbul ignore file */
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 {
2
+ import AppiumLauncher from './launcher.js';
3
+ export default class AppiumService {
24
4
  }
25
- exports.default = AppiumService;
26
- exports.launcher = launcher_1.default;
27
- __exportStar(require("./types"), exports);
5
+ export const launcher = AppiumLauncher;
6
+ export * from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAYzE,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,OAAO,CAAC,QAAQ,CAAC,K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anC"}
package/build/launcher.js CHANGED
@@ -1,15 +1,10 @@
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');
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');
13
8
  const DEFAULT_LOG_FILENAME = 'wdio-appium.log';
14
9
  const DEFAULT_CONNECTION = {
15
10
  protocol: 'http',
@@ -17,9 +12,14 @@ const DEFAULT_CONNECTION = {
17
12
  port: 4723,
18
13
  path: '/'
19
14
  };
20
- class AppiumLauncher {
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 {
21
22
  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 @@ class AppiumLauncher {
28
28
  basePath: DEFAULT_CONNECTION.path,
29
29
  ...(this._options.args || {})
30
30
  };
31
- this._logPath = _options.logPath || ((_a = this._config) === null || _a === void 0 ? void 0 : _a.outputDir);
31
+ this._logPath = _options.logPath || this._config?.outputDir;
32
32
  this._command = this._getCommand(_options.command);
33
33
  }
34
34
  _getCommand(command) {
@@ -61,22 +61,22 @@ 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
- !(0, config_1.isCloudCapability)(c) && Object.assign(capability, DEFAULT_CONNECTION, 'port' in this._args ? { port: this._args.port } : {}, { path: this._args.basePath }, { ...capability });
64
+ !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) => !(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 }));
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 }));
69
69
  }
70
70
  async onPrepare() {
71
71
  /**
72
72
  * Append remaining arguments
73
73
  */
74
- this._appiumCliArgs.push(...(0, utils_1.formatCliArgs)(this._args));
74
+ this._appiumCliArgs.push(...formatCliArgs(this._args));
75
75
  this._setCapabilities();
76
76
  /**
77
77
  * start Appium
78
78
  */
79
- this._process = await (0, util_1.promisify)(this._startAppium)(this._command, this._appiumCliArgs);
79
+ this._process = await promisify(this._startAppium)(this._command, this._appiumCliArgs);
80
80
  if (this._logPath) {
81
81
  this._redirectLogStream(this._logPath);
82
82
  }
@@ -89,7 +89,7 @@ class AppiumLauncher {
89
89
  }
90
90
  _startAppium(command, args, callback) {
91
91
  log.debug(`Will spawn Appium process: ${command} ${args.join(' ')}`);
92
- let process = (0, child_process_1.spawn)(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
92
+ let process = 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 @@ class AppiumLauncher {
114
114
  if (!this._process) {
115
115
  throw Error('No Appium process to redirect log stream');
116
116
  }
117
- const logFile = (0, utils_1.getFilePath)(logPath, DEFAULT_LOG_FILENAME);
117
+ const logFile = getFilePath(logPath, DEFAULT_LOG_FILENAME);
118
118
  // ensure file & directory exists
119
- (0, fs_extra_1.ensureFileSync)(logFile);
119
+ ensureFileSync(logFile);
120
120
  log.debug(`Appium logs written to: ${logFile}`);
121
- const logStream = (0, fs_extra_1.createWriteStream)(logFile, { flags: 'w' });
121
+ const logStream = createWriteStream(logFile, { flags: 'w' });
122
122
  this._process.stdout.pipe(logStream);
123
123
  this._process.stderr.pipe(logStream);
124
124
  }
@@ -135,4 +135,3 @@ class AppiumLauncher {
135
135
  }
136
136
  }
137
137
  }
138
- exports.default = AppiumLauncher;
package/build/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/build/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ArgValue, KeyValueArgs } from './types';
1
+ import type { 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,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"}
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"}
package/build/utils.js CHANGED
@@ -1,8 +1,5 @@
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");
1
+ import { basename, join, resolve } from 'node:path';
2
+ import { paramCase } from 'param-case';
6
3
  const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
7
4
  /**
8
5
  * Resolves the given path into a absolute path and appends the default filename as fallback when the provided path is a directory.
@@ -10,17 +7,16 @@ const FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
10
7
  * @param {String} defaultFilename default file name when filePath is a directory
11
8
  * @return {String} absolute file path
12
9
  */
13
- function getFilePath(filePath, defaultFilename) {
14
- let absolutePath = (0, path_1.resolve)(filePath);
10
+ export function getFilePath(filePath, defaultFilename) {
11
+ let absolutePath = resolve(filePath);
15
12
  // test if we already have a file (e.g. selenium.txt, .log, log.txt, etc.)
16
13
  // NOTE: path.extname doesn't work to detect a file, cause dotfiles are reported by node to have no extension
17
- if (!FILE_EXTENSION_REGEX.test((0, path_1.basename)(absolutePath))) {
18
- absolutePath = (0, path_1.join)(absolutePath, defaultFilename);
14
+ if (!FILE_EXTENSION_REGEX.test(basename(absolutePath))) {
15
+ absolutePath = join(absolutePath, defaultFilename);
19
16
  }
20
17
  return absolutePath;
21
18
  }
22
- exports.getFilePath = getFilePath;
23
- function formatCliArgs(args) {
19
+ export function formatCliArgs(args) {
24
20
  if (Array.isArray(args)) {
25
21
  return args.map(arg => sanitizeCliOptionValue(arg));
26
22
  }
@@ -31,7 +27,7 @@ function formatCliArgs(args) {
31
27
  if ((typeof value === 'boolean' && !value) || value === null) {
32
28
  continue;
33
29
  }
34
- cliArgs.push(`--${(0, param_case_1.paramCase)(key)}`);
30
+ cliArgs.push(`--${paramCase(key)}`);
35
31
  // Only non-boolean and non-null values are added as option values
36
32
  if (typeof value !== 'boolean') {
37
33
  cliArgs.push(sanitizeCliOptionValue(value));
@@ -39,14 +35,11 @@ function formatCliArgs(args) {
39
35
  }
40
36
  return cliArgs;
41
37
  }
42
- exports.formatCliArgs = formatCliArgs;
43
- function sanitizeCliOptionValue(value) {
38
+ export function sanitizeCliOptionValue(value) {
44
39
  const valueString = String(value);
45
40
  // Encapsulate the value string in single quotes if it contains a white space
46
41
  return /\s/.test(valueString) ? `'${valueString}'` : valueString;
47
42
  }
48
- exports.sanitizeCliOptionValue = sanitizeCliOptionValue;
49
- function isWindows() {
43
+ export function isWindows() {
50
44
  return process.platform === 'win32';
51
45
  }
52
- exports.isWindows = isWindows;
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@wdio/appium-service",
3
- "version": "7.20.7",
3
+ "version": "7.20.8-alpha.219+4aab2cef1",
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",
9
8
  "engines": {
10
- "node": ">=12.0.0"
9
+ "node": "^16.13 || >=18"
11
10
  },
12
11
  "repository": {
13
12
  "type": "git",
@@ -25,20 +24,23 @@
25
24
  "bugs": {
26
25
  "url": "https://github.com/webdriverio/webdriverio/issues"
27
26
  },
27
+ "type": "module",
28
+ "exports": "./build/index.js",
29
+ "types": "./build/index.d.ts",
30
+ "typeScriptVersion": "3.8.3",
28
31
  "dependencies": {
29
- "@types/fs-extra": "^9.0.4",
32
+ "@types/fs-extra": "^9.0.13",
30
33
  "@wdio/config": "7.20.7",
31
34
  "@wdio/logger": "7.19.0",
32
35
  "@wdio/types": "7.20.7",
33
- "fs-extra": "^10.0.0",
34
- "param-case": "^3.0.0"
36
+ "fs-extra": "^10.1.0",
37
+ "param-case": "^3.0.4"
35
38
  },
36
39
  "peerDependencies": {
37
- "@wdio/cli": "^7.0.0"
40
+ "@wdio/cli": "next"
38
41
  },
39
42
  "publishConfig": {
40
43
  "access": "public"
41
44
  },
42
- "types": "./build/index.d.ts",
43
- "gitHead": "21b8b61453f4749d87eca3e4d7d6e5e2cb60f043"
45
+ "gitHead": "4aab2cef1b8b195ac8cc611f28b1fd54e4ba3443"
44
46
  }