@wdio/appium-service 9.0.0-alpha.367 → 9.0.0-alpha.426

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.
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAY5E,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;IAO/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IARpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAA+C;gBAGpD,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,YAAY,CAAC,sBAAsB,EAClD,OAAO,CAAC,gCAAoB;YAS1B,WAAW;IAqBzB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAkDlB,SAAS;IAgCf,UAAU;IAMV,OAAO,CAAC,YAAY;YAoEN,kBAAkB;mBAeX,iBAAiB;CAezC"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAY5E,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,QAAQ,CAAC,eAAe;IAO/D,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,OAAO,CAAC;IARpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,CAA+C;gBAGpD,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,YAAY,CAAC,sBAAsB,EAClD,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,YAAA;YAS1B,WAAW;IAqBzB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAkDlB,SAAS;IAiCf,UAAU;IAgBV,OAAO,CAAC,YAAY;YAoEN,kBAAkB;mBAeX,iBAAiB;CAezC"}
package/build/launcher.js CHANGED
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import fsp from 'node:fs/promises';
3
3
  import url from 'node:url';
4
4
  import path from 'node:path';
5
+ import treeKill from 'tree-kill';
5
6
  import { spawn } from 'node:child_process';
6
7
  import logger from '@wdio/logger';
7
8
  import getPort from 'get-port';
@@ -100,16 +101,15 @@ export default class AppiumLauncher {
100
101
  throw new Error('Args should be an object');
101
102
  }
102
103
  /**
103
- * Append remaining arguments
104
+ * Use port from service option or get a random port
104
105
  */
105
- this._appiumCliArgs.push(...formatCliArgs(this._args));
106
+ this._args.port = typeof this._args.port === 'number' ? this._args.port
107
+ : await getPort({ port: DEFAULT_APPIUM_PORT });
108
+ this._setCapabilities(this._args.port);
106
109
  /**
107
- * Get port from service option or use a random port
110
+ * Append cli arguments
108
111
  */
109
- const port = typeof this._args.port === 'number'
110
- ? this._args.port
111
- : await getPort({ port: DEFAULT_APPIUM_PORT });
112
- this._setCapabilities(port);
112
+ this._appiumCliArgs.push(...formatCliArgs({ ...this._args }));
113
113
  /**
114
114
  * start Appium
115
115
  */
@@ -120,9 +120,18 @@ export default class AppiumLauncher {
120
120
  }
121
121
  }
122
122
  onComplete() {
123
- if (this._process) {
124
- log.info(`Appium (pid: ${this._process.pid}) killed`);
125
- this._process.kill();
123
+ // Kill appium and all process' spawned from it
124
+ if (this._process && this._process.pid) {
125
+ // Ensure all child processes are also killed
126
+ log.info('Killing entire Appium tree');
127
+ treeKill(this._process.pid, 'SIGTERM', (err) => {
128
+ if (err) {
129
+ log.warn('Failed to kill process:', err);
130
+ }
131
+ else {
132
+ log.info('Process and its children successfully terminated');
133
+ }
134
+ });
126
135
  }
127
136
  }
128
137
  _startAppium(command, args, timeout = APPIUM_START_TIMEOUT) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/appium-service",
3
- "version": "9.0.0-alpha.367+1c1d44229",
3
+ "version": "9.0.0-alpha.426+d760644c4",
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",
@@ -33,17 +33,18 @@
33
33
  },
34
34
  "typeScriptVersion": "3.8.3",
35
35
  "dependencies": {
36
- "@wdio/config": "9.0.0-alpha.367+1c1d44229",
37
- "@wdio/logger": "9.0.0-alpha.367+1c1d44229",
38
- "@wdio/types": "9.0.0-alpha.367+1c1d44229",
39
- "@wdio/utils": "9.0.0-alpha.367+1c1d44229",
36
+ "@wdio/config": "9.0.0-alpha.426+d760644c4",
37
+ "@wdio/logger": "9.0.0-alpha.426+d760644c4",
38
+ "@wdio/types": "9.0.0-alpha.426+d760644c4",
39
+ "@wdio/utils": "9.0.0-alpha.426+d760644c4",
40
40
  "change-case": "^5.4.3",
41
41
  "get-port": "^7.0.0",
42
42
  "import-meta-resolve": "^4.0.0",
43
- "webdriverio": "9.0.0-alpha.367+1c1d44229"
43
+ "tree-kill": "^1.2.2",
44
+ "webdriverio": "9.0.0-alpha.426+d760644c4"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "1c1d44229632b8a472ca68155fdd5c001da07145"
49
+ "gitHead": "d760644c4c6e1ef910c0bee120cb422e25dbbe06"
49
50
  }
File without changes