Skip to content

Commit c54edf4

Browse files
Fix review comments
Co-authored-by: SrinivasanTarget <srinivasan.sekar1990@gmail.com>
1 parent ecd46b6 commit c54edf4

3 files changed

Lines changed: 11 additions & 35 deletions

File tree

lib/ios-fs-helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export async function pullFolder(afcService, remoteRootPath) {
106106
});
107107
// Wait for the rest of files to be pulled
108108
if (!_.isEmpty(pullPromises)) {
109-
await B.all(pullPromises.filter((p) => !p.isFulfilled()));
109+
await B.all(pullPromises);
110110
}
111111
log.info(
112112
`Pulled ${util.pluralize('file', countFilesSuccess, true)} out of ` +

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@
100100
"source-map-support": "^0.x",
101101
"teen_process": "^2.2.0",
102102
"winston": "3.17.0",
103-
"ws": "^8.13.0",
104-
"appium-ios-remotexpc": "file:/Users/srinivasans/workspace/LT/appium-ios-remotexpc"
103+
"ws": "^8.13.0"
105104
},
106105
"scripts": {
107106
"build": "tsc -b",

scripts/tunnel-creation.mjs

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Test script for creating lockdown service, starting CoreDeviceProxy, and creating tunnel
44
* This script demonstrates the tunnel creation workflow for all connected devices
55
*/
6-
import {logger} from '@appium/support';
6+
import {logger, node} from '@appium/support';
77
import _ from 'lodash';
88
/* eslint-disable import/no-unresolved */
99
import {
@@ -18,9 +18,6 @@ import {
1818
import {strongbox} from '@appium/strongbox';
1919
import path from 'path';
2020
import fs from 'fs';
21-
import {fileURLToPath} from 'url';
22-
23-
const __filename = fileURLToPath(import.meta.url);
2421

2522
const log = logger.getLogger('TunnelCreation');
2623
const TUNNEL_REGISTRY_PORT = 'tunnelRegistryPort';
@@ -287,8 +284,13 @@ class TunnelCreator {
287284
}
288285
}
289286

290-
// Helper function to parse string arguments
291-
const parseArg = (args, flagName) => {
287+
/**
288+
* Helper function to parse string arguments
289+
* @param {string[]} args - Array of command line arguments
290+
* @param {string} flagName - Name of the flag to parse (e.g. '--udid')
291+
* @returns {string|undefined} The value of the flag if found, undefined otherwise
292+
*/
293+
function parseArg(args, flagName) {
292294
const equalsArg = args.find((arg) => arg.startsWith(`${flagName}=`));
293295
if (equalsArg) {
294296
const value = equalsArg.split('=')[1];
@@ -305,32 +307,7 @@ const parseArg = (args, flagName) => {
305307
return undefined;
306308
};
307309

308-
/**
309-
* Calculates the path to the current module's root folder
310-
*
311-
* @returns {string} The full path to module root
312-
* @throws {Error} If the current module root folder cannot be determined
313-
*/
314-
const getModuleRoot = _.memoize(function getModuleRoot() {
315-
let currentDir = path.dirname(path.resolve(__filename));
316-
let isAtFsRoot = false;
317-
while (!isAtFsRoot) {
318-
const manifestPath = path.join(currentDir, 'package.json');
319-
try {
320-
if (
321-
fs.existsSync(manifestPath) &&
322-
JSON.parse(fs.readFileSync(manifestPath, 'utf8')).name === 'appium-xcuitest-driver'
323-
) {
324-
return currentDir;
325-
}
326-
} catch {}
327-
currentDir = path.dirname(currentDir);
328-
isAtFsRoot = currentDir.length <= path.dirname(currentDir).length;
329-
}
330-
throw new Error('Cannot find the root folder of the appium-xcuitest-driver Node.js module');
331-
});
332-
333-
const BOOTSTRAP_PATH = getModuleRoot();
310+
const BOOTSTRAP_PATH = node.getModuleRootSync('appium-xcuitest-driver', import.meta.url);
334311

335312
/**
336313
*/

0 commit comments

Comments
 (0)