appium-mac2-driver 1.4.2 → 1.4.4
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/README.md +6 -4
- package/WebDriverAgentMac/WebDriverAgentLib/Commands/FBElementCommands.m +1 -1
- package/WebDriverAgentMac/WebDriverAgentLib/Commands/FBScreenshotCommands.m +2 -3
- package/WebDriverAgentMac/WebDriverAgentLib/Utilities/AMSnapshotUtils.m +1 -1
- package/build/index.js +1 -5
- package/build/lib/commands/app-management.js +1 -4
- package/build/lib/commands/app-management.js.map +1 -0
- package/build/lib/commands/applescript.js +2 -19
- package/build/lib/commands/applescript.js.map +1 -0
- package/build/lib/commands/execute.js +1 -13
- package/build/lib/commands/execute.js.map +1 -0
- package/build/lib/commands/find.js +2 -8
- package/build/lib/commands/find.js.map +1 -0
- package/build/lib/commands/gestures.js +1 -20
- package/build/lib/commands/gestures.js.map +1 -0
- package/build/lib/commands/index.js +3 -13
- package/build/lib/commands/index.js.map +1 -0
- package/build/lib/commands/record-screen.js +1 -63
- package/build/lib/commands/record-screen.js.map +1 -0
- package/build/lib/commands/screenshots.js +2 -4
- package/build/lib/commands/screenshots.js.map +1 -0
- package/build/lib/commands/source.js +1 -4
- package/build/lib/commands/source.js.map +1 -0
- package/build/lib/desired-caps.js +1 -3
- package/build/lib/desired-caps.js.map +1 -0
- package/build/lib/driver.js +1 -33
- package/build/lib/driver.js.map +1 -0
- package/build/lib/logger.js +1 -5
- package/build/lib/logger.js.map +1 -0
- package/build/lib/utils.js +7 -27
- package/build/lib/utils.js.map +1 -0
- package/build/lib/wda-mac.js +2 -109
- package/build/lib/wda-mac.js.map +1 -0
- package/lib/utils.js +7 -15
- package/npm-shrinkwrap.json +1493 -1346
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wda-mac.js","names":["log","logger","getLogger","DEFAULT_WDA_ROOT","path","resolve","getModuleRoot","WDA_PROJECT_NAME","WDA_PROJECT","wdaRoot","RUNNER_SCHEME","DISABLE_STORE_ARG","XCODEBUILD","STARTUP_TIMEOUT_MS","DEFAULT_SYSTEM_PORT","DEFAULT_SYSTEM_HOST","DEFAULT_SHOW_SERVER_LOGS","RUNNING_PROCESS_IDS","RECENT_UPGRADE_TIMESTAMP_PATH","join","getUpgradeTimestamp","packageManifest","fs","exists","mtime","stat","getTime","cleanupObsoleteProcesses","_","isEmpty","debug","length","util","pluralize","exec","ign","pullAll","process","once","execSync","WDAMacProxy","JWProxy","proxyCommand","url","method","body","didProcessExit","errors","InvalidContextError","WDAMacProcess","constructor","showServerLogs","port","host","bootstrapRoot","proc","isRunning","pid","listChildrenPids","listChildrenProcessIds","isFreshUpgrade","homeFolder","env","HOME","info","currentUpgradeTimestamp","isInteger","timestampPath","access","W_OK","recentUpgradeTimestamp","parseInt","readFile","warn","mkdirp","dirname","writeFile","e","message","hasSameOpts","systemPort","systemHost","isBoolean","isNil","init","opts","Error","kill","xcodebuild","which","args","cwd","stderr","isPortBusy","checkPortStatus","timer","timing","Timer","start","axios","delete","timeout","B","delay","waitForCondition","waitMs","intervalMs","Math","round","getDuration","asMilliSeconds","Object","assign","USE_PORT","USE_HOST","SubProcess","on","stdout","line","trim","code","signal","quote","stop","childrenPids","WDAMacServer","serverStartupTimeoutMs","proxy","isProxyingToRemoteServer","isProxyReady","throwOnExit","command","err","parseProxyProperties","caps","scheme","webDriverAgentMacUrl","server","parsedUrl","URL","protocol","hostname","pathname","isString","split","startSession","serverStartupTimeout","wasProcessInitNecessary","base","keepAlive","test","msg","push","pull","toFixed","capabilities","firstMatch","alwaysMatch","stopSession","sessionId","WDA_MAC_SERVER"],"sources":["../../lib/wda-mac.js"],"sourcesContent":["import _ from 'lodash';\nimport path from 'path';\nimport url from 'url';\nimport axios from 'axios';\nimport B from 'bluebird';\nimport { JWProxy, errors } from 'appium/driver';\nimport { fs, logger, util, timing, mkdirp } from 'appium/support';\nimport { SubProcess, exec } from 'teen_process';\nimport { waitForCondition } from 'asyncbox';\nimport { checkPortStatus } from 'portscanner';\nimport { execSync } from 'child_process';\nimport { listChildrenProcessIds, getModuleRoot } from './utils';\n\nconst log = logger.getLogger('WebDriverAgentMac');\n\nconst DEFAULT_WDA_ROOT = path.resolve(getModuleRoot(), 'WebDriverAgentMac');\nconst WDA_PROJECT_NAME = 'WebDriverAgentMac.xcodeproj';\nconst WDA_PROJECT = (wdaRoot = DEFAULT_WDA_ROOT) => path.resolve(wdaRoot, WDA_PROJECT_NAME);\nconst RUNNER_SCHEME = 'WebDriverAgentRunner';\nconst DISABLE_STORE_ARG = 'COMPILER_INDEX_STORE_ENABLE=NO';\nconst XCODEBUILD = 'xcodebuild';\nconst STARTUP_TIMEOUT_MS = 120000;\nconst DEFAULT_SYSTEM_PORT = 10100;\nconst DEFAULT_SYSTEM_HOST = '127.0.0.1';\nconst DEFAULT_SHOW_SERVER_LOGS = false;\nconst RUNNING_PROCESS_IDS = [];\nconst RECENT_UPGRADE_TIMESTAMP_PATH = path.join('.appium', 'webdriveragent_mac', 'upgrade.time');\n\n\nasync function getUpgradeTimestamp () {\n const packageManifest = path.resolve(getModuleRoot(), 'package.json');\n if (!await fs.exists(packageManifest)) {\n return null;\n }\n const {mtime} = await fs.stat(packageManifest);\n return mtime.getTime();\n}\n\nasync function cleanupObsoleteProcesses () {\n if (!_.isEmpty(RUNNING_PROCESS_IDS)) {\n log.debug(`Cleaning up ${RUNNING_PROCESS_IDS.length} obsolete ` +\n util.pluralize('process', RUNNING_PROCESS_IDS.length, false));\n try {\n await exec('kill', ['-9', ...RUNNING_PROCESS_IDS]);\n } catch (ign) {}\n _.pullAll(RUNNING_PROCESS_IDS, RUNNING_PROCESS_IDS);\n }\n}\n\nprocess.once('exit', () => {\n if (!_.isEmpty(RUNNING_PROCESS_IDS)) {\n try {\n execSync(`kill -9 ${RUNNING_PROCESS_IDS.join(' ')}`);\n } catch (ign) {}\n _.pullAll(RUNNING_PROCESS_IDS, RUNNING_PROCESS_IDS);\n }\n});\n\n\nclass WDAMacProxy extends JWProxy {\n async proxyCommand (url, method, body = null) {\n if (this.didProcessExit) {\n throw new errors.InvalidContextError(\n `'${method} ${url}' cannot be proxied to Mac2 Driver server because ` +\n 'its process is not running (probably crashed). Check the Appium log for more details');\n }\n return await super.proxyCommand(url, method, body);\n }\n}\n\nclass WDAMacProcess {\n constructor () {\n this.showServerLogs = DEFAULT_SHOW_SERVER_LOGS;\n this.port = DEFAULT_SYSTEM_PORT;\n this.host = DEFAULT_SYSTEM_HOST;\n this.bootstrapRoot = DEFAULT_WDA_ROOT;\n this.proc = null;\n }\n\n get isRunning () {\n return !!(this.proc?.isRunning);\n }\n\n get pid () {\n return this.isRunning ? this.proc.pid : null;\n }\n\n async listChildrenPids () {\n return this.pid ? (await listChildrenProcessIds(this.pid)) : [];\n }\n\n async isFreshUpgrade () {\n const homeFolder = process.env.HOME;\n if (!homeFolder) {\n log.info('The HOME folder path cannot be determined');\n return false;\n }\n\n const currentUpgradeTimestamp = await getUpgradeTimestamp();\n if (!_.isInteger(currentUpgradeTimestamp)) {\n log.info('It is impossible to determine the timestamp of the package');\n return false;\n }\n\n const timestampPath = path.resolve(homeFolder, RECENT_UPGRADE_TIMESTAMP_PATH);\n if (await fs.exists(timestampPath)) {\n try {\n await fs.access(timestampPath, fs.W_OK);\n } catch (ign) {\n log.info(`WebDriverAgent upgrade timestamp at '${timestampPath}' is not writeable`);\n return false;\n }\n const recentUpgradeTimestamp = parseInt(await fs.readFile(timestampPath, 'utf8'), 10);\n if (_.isInteger(recentUpgradeTimestamp)) {\n if (recentUpgradeTimestamp >= currentUpgradeTimestamp) {\n log.info(`WebDriverAgent sources are up to date ` +\n `(${recentUpgradeTimestamp} >= ${currentUpgradeTimestamp})`);\n return false;\n }\n log.info(`WebDriverAgent sources have been upgraded ` +\n `(${recentUpgradeTimestamp} < ${currentUpgradeTimestamp})`);\n } else {\n log.warn(`The recent upgrade timestamp at '${timestampPath}' is corrupted. Trying to fix it`);\n }\n }\n\n try {\n await mkdirp(path.dirname(timestampPath));\n await fs.writeFile(timestampPath, `${currentUpgradeTimestamp}`, 'utf8');\n log.debug(`Stored the recent WebDriverAgent upgrade timestamp ${currentUpgradeTimestamp} ` +\n `at '${timestampPath}'`);\n } catch (e) {\n log.info(`Unable to create the recent WebDriverAgent upgrade timestamp at '${timestampPath}'. ` +\n `Original error: ${e.message}`);\n return false;\n }\n\n return true;\n }\n\n hasSameOpts ({ showServerLogs, systemPort, systemHost, bootstrapRoot }) {\n if (_.isBoolean(showServerLogs) && this.showServerLogs !== showServerLogs\n || _.isNil(showServerLogs) && this.showServerLogs !== DEFAULT_SHOW_SERVER_LOGS) {\n return false;\n }\n if (systemPort && this.port !== systemPort\n || !systemPort && this.port !== DEFAULT_SYSTEM_PORT) {\n return false;\n }\n if (systemHost && this.host !== systemHost\n || !systemHost && this.host !== DEFAULT_SYSTEM_HOST) {\n return false;\n }\n if (bootstrapRoot && this.bootstrapRoot !== bootstrapRoot\n || !bootstrapRoot && this.bootstrapRoot !== DEFAULT_WDA_ROOT) {\n return false;\n }\n\n return true;\n }\n\n async init (opts = {}) {\n if (this.isRunning && this.hasSameOpts(opts)) {\n return false;\n }\n\n this.showServerLogs = opts.showServerLogs ?? this.showServerLogs;\n this.port = opts.systemPort ?? this.port;\n this.host = opts.systemHost ?? this.host;\n this.bootstrapRoot = opts.bootstrapRoot ?? this.bootstrapRoot;\n\n log.debug(`Using bootstrap root: ${this.bootstrapRoot}`);\n if (!await fs.exists(WDA_PROJECT(this.bootstrapRoot))) {\n throw new Error(`${WDA_PROJECT_NAME} does not exist at '${WDA_PROJECT(this.bootstrapRoot)}'. ` +\n `Was 'bootstrapRoot' set to a proper value?`);\n }\n\n await this.kill();\n await cleanupObsoleteProcesses();\n\n let xcodebuild;\n try {\n xcodebuild = await fs.which(XCODEBUILD);\n } catch (e) {\n throw new Error(`${XCODEBUILD} binary cannot be found in PATH. ` +\n `Please make sure that Xcode is installed on your system`);\n }\n log.debug(`Using ${XCODEBUILD} binary at '${xcodebuild}'`);\n\n if (await this.isFreshUpgrade()) {\n log.info('Performing project cleanup');\n const args = [\n 'clean',\n '-project', WDA_PROJECT(this.bootstrapRoot),\n '-scheme', RUNNER_SCHEME,\n ];\n try {\n await exec(XCODEBUILD, args, {\n cwd: this.bootstrapRoot,\n });\n } catch (e) {\n log.warn(`Cannot perform project cleanup. ` +\n `Original error: ${e.stderr || e.message}`);\n }\n }\n\n log.debug(`Using ${this.host} as server host`);\n log.debug(`Using port ${this.port}`);\n const isPortBusy = async () => (await checkPortStatus(this.port, this.host)) === 'open';\n if (await isPortBusy()) {\n log.warn(`The port #${this.port} at ${this.host} is busy. ` +\n `Assuming it is an obsolete WDA server instance and ` +\n `trying to terminate it in order to start a new one`);\n const timer = new timing.Timer().start();\n try {\n await axios.delete(`http://${this.host}:${this.port}/`, {\n timeout: 5000,\n });\n // Give the server some time to finish and stop listening\n await B.delay(500);\n await waitForCondition(async () => !(await isPortBusy()), {\n waitMs: 3000,\n intervalMs: 100,\n });\n } catch (e) {\n log.warn(`Did not know how to terminate the process at ${this.host}:${this.port}: ${e.message}. ` +\n `Perhaps, it is not a WDA server, which is hogging the port?`);\n throw new Error(`The port #${this.port} at ${this.host} is busy. ` +\n `Consider setting 'systemPort' capability to another free port number and/or ` +\n `make sure previous driver sessions have been closed properly.`);\n }\n log.info(`The previously running WDA server has been successfully terminated after ` +\n `${Math.round(timer.getDuration().asMilliSeconds)}ms`);\n }\n\n const args = [\n 'build-for-testing', 'test-without-building',\n '-project', WDA_PROJECT(this.bootstrapRoot),\n '-scheme', RUNNER_SCHEME,\n DISABLE_STORE_ARG,\n ];\n const env = Object.assign({}, process.env, {\n USE_PORT: `${this.port}`,\n USE_HOST: this.host,\n });\n this.proc = new SubProcess(xcodebuild, args, {\n cwd: this.bootstrapRoot,\n env,\n });\n if (!this.showServerLogs) {\n log.info(`Mac2Driver host process logging is disabled. ` +\n `All the ${XCODEBUILD} output is going to be suppressed. ` +\n `Set the 'showServerLogs' capability to 'true' if this is an undesired behavior`);\n }\n this.proc.on('output', (stdout, stderr) => {\n if (!this.showServerLogs) {\n return;\n }\n\n const line = _.trim(stdout || stderr);\n if (line) {\n log.debug(`[${XCODEBUILD}] ${line}`);\n }\n });\n this.proc.on('exit', (code, signal) => {\n log.info(`Mac2Driver host process has exited with code ${code}, signal ${signal}`);\n });\n log.info(`Starting Mac2Driver host process: ${XCODEBUILD} ${util.quote(args)}`);\n await this.proc.start(0);\n return true;\n }\n\n async stop () {\n if (!this.isRunning) {\n return;\n }\n\n const childrenPids = await this.listChildrenPids();\n if (!_.isEmpty(childrenPids)) {\n try {\n await exec('kill', childrenPids);\n } catch (ign) {}\n }\n await this.proc.stop('SIGTERM', 3000);\n }\n\n async kill () {\n if (!this.isRunning) {\n return;\n }\n\n const childrenPids = await this.listChildrenPids();\n if (!_.isEmpty(childrenPids)) {\n try {\n await exec('kill', ['-9', ...childrenPids]);\n } catch (ign) {}\n }\n try {\n await this.proc.stop('SIGKILL');\n } catch (ign) {}\n }\n}\n\nclass WDAMacServer {\n constructor () {\n this.process = null;\n this.serverStartupTimeoutMs = STARTUP_TIMEOUT_MS;\n this.proxy = null;\n\n // To handle if the WDAMac server is proxying requests to a remote WDAMac app instance\n this.isProxyingToRemoteServer = false;\n }\n\n async isProxyReady (throwOnExit = true) {\n if (!this.proxy) {\n return false;\n }\n\n try {\n await this.proxy.command('/status', 'GET');\n return true;\n } catch (err) {\n if (throwOnExit && this.proxy.didProcessExit) {\n throw new Error(err.message);\n }\n return false;\n }\n }\n\n\n /**\n * @typedef {Object} ProxyProperties\n *\n * @property {string} scheme - The scheme proxy to.\n * @property {string} host - The host name proxy to.\n * @property {number} port - The port number proxy to.\n * @property {string} path - The path proxy to.\n */\n\n /**\n * Returns proxy information where WDAMacServer proxy to.\n *\n * @param {Object} caps - The capabilities in the session.\n * @return {ProxyProperties}\n * @throws Error if 'webDriverAgentMacUrl' had invalid URL\n */\n parseProxyProperties (caps) {\n let scheme = 'http';\n if (!caps.webDriverAgentMacUrl) {\n return {\n scheme,\n server: (this.process?.host ?? caps.systemHost) ?? DEFAULT_SYSTEM_HOST,\n port: (this.process?.port ?? caps.systemPort) ?? DEFAULT_SYSTEM_PORT,\n path: ''\n };\n }\n\n let parsedUrl;\n try {\n parsedUrl = new url.URL(caps.webDriverAgentMacUrl);\n } catch (e) {\n throw new Error(`webDriverAgentMacUrl, '${caps.webDriverAgentMacUrl}', ` +\n `in the capabilities is invalid. ${e.message}`);\n }\n\n const { protocol, hostname, port, pathname } = parsedUrl;\n if (_.isString(protocol)) {\n scheme = protocol.split(':')[0];\n }\n return {\n scheme,\n server: hostname ?? DEFAULT_SYSTEM_HOST,\n port: _.isEmpty(port) ? DEFAULT_SYSTEM_PORT : _.parseInt(port),\n path: pathname === '/' ? '' : pathname\n };\n }\n\n async startSession (caps) {\n this.serverStartupTimeoutMs = caps.serverStartupTimeout ?? this.serverStartupTimeoutMs;\n\n this.isProxyingToRemoteServer = !!caps.webDriverAgentMacUrl;\n\n let wasProcessInitNecessary;\n if (this.isProxyingToRemoteServer) {\n if (this.process) {\n await this.process.kill();\n await cleanupObsoleteProcesses();\n this.process = null;\n }\n\n wasProcessInitNecessary = false;\n } else {\n if (!this.process) {\n this.process = new WDAMacProcess();\n }\n wasProcessInitNecessary = await this.process.init(caps);\n }\n\n if (wasProcessInitNecessary || this.isProxyingToRemoteServer || !this.proxy) {\n const {scheme, server, port, path} = this.parseProxyProperties(caps);\n this.proxy = new WDAMacProxy({\n scheme,\n server,\n port,\n base: path,\n keepAlive: true,\n });\n this.proxy.didProcessExit = false;\n\n if (this.process) {\n this.process.proc.on('exit', () => {\n this.proxy.didProcessExit = true;\n });\n }\n\n const timer = new timing.Timer().start();\n try {\n await waitForCondition(async () => await this.isProxyReady(), {\n waitMs: this.serverStartupTimeoutMs,\n intervalMs: 1000,\n });\n } catch (e) {\n if (this.process?.isRunning) {\n // avoid \"frozen\" processes,\n await this.process.kill();\n }\n if (/Condition unmet/.test(e.message)) {\n const msg = this.isProxyingToRemoteServer\n ? `No response from '${scheme}://${server}:${port}${path}' within ${this.serverStartupTimeoutMs}ms timeout.` +\n `Please make sure the remote server is running and accessible by Appium`\n : `Mac2Driver server is not listening within ${this.serverStartupTimeoutMs}ms timeout. ` +\n `Try to increase the value of 'serverStartupTimeout' capability, check the server logs ` +\n `and make sure the ${XCODEBUILD} host process could be started manually from a terminal`;\n throw new Error(msg);\n }\n throw e;\n }\n\n if (this.process) {\n const pid = this.process.pid;\n const childrenPids = await this.process.listChildrenPids();\n RUNNING_PROCESS_IDS.push(...childrenPids, pid);\n this.process.proc.on('exit', () => void _.pull(RUNNING_PROCESS_IDS, pid));\n log.info(`The host process is ready within ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n }\n } else {\n log.info('The host process has already been listening. Proceeding with session creation');\n }\n\n await this.proxy.command('/session', 'POST', {\n capabilities: {\n firstMatch: [{}],\n alwaysMatch: caps,\n }\n });\n }\n\n async stopSession () {\n if (!this.isProxyingToRemoteServer && !(this.process?.isRunning)) {\n log.info(`Mac2Driver session cannot be stopped, because the server is not running`);\n return;\n }\n\n if (this.proxy?.sessionId) {\n try {\n await this.proxy.command(`/session/${this.proxy.sessionId}`, 'DELETE');\n } catch (e) {\n log.info(`Mac2Driver session cannot be deleted. Original error: ${e.message}`);\n }\n }\n }\n}\n\nconst WDA_MAC_SERVER = new WDAMacServer();\n\nexport default WDA_MAC_SERVER;\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,GAAG,GAAGC,eAAM,CAACC,SAAS,CAAC,mBAAmB,CAAC;AAEjD,MAAMC,gBAAgB,GAAGC,aAAI,CAACC,OAAO,CAAC,IAAAC,oBAAa,GAAE,EAAE,mBAAmB,CAAC;AAC3E,MAAMC,gBAAgB,GAAG,6BAA6B;AACtD,MAAMC,WAAW,GAAG,CAACC,OAAO,GAAGN,gBAAgB,KAA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CAAC,CAAC,CAAC;QAChBC,WAAW,EAAEvB;MACf;IACF,CAAC,CAAC;EACJ;EAEA,MAAMwB,WAAW,GAAI;IAAA;IACnB,IAAI,CAAC,IAAI,CAAC9B,wBAAwB,IAAI,oBAAE,IAAI,CAAC3F,OAAO,2CAAZ,eAAcmB,SAAS,CAAC,EAAE;MAChExD,GAAG,CAACgE,IAAI,CAAE,yEAAwE,CAAC;MACnF;IACF;IAEA,mBAAI,IAAI,CAAC+D,KAAK,wCAAV,YAAYgC,SAAS,EAAE;MACzB,IAAI;QACF,MAAM,IAAI,CAAChC,KAAK,CAACI,OAAO,CAAE,YAAW,IAAI,CAACJ,KAAK,CAACgC,SAAU,EAAC,EAAE,QAAQ,CAAC;MACxE,CAAC,CAAC,OAAOlF,CAAC,EAAE;QACV7E,GAAG,CAACgE,IAAI,CAAE,yDAAwDa,CAAC,CAACC,OAAQ,EAAC,CAAC;MAChF;IACF;EACF;AACF;AAEA,MAAMkF,cAAc,GAAG,IAAInC,YAAY,EAAE;AAAC,eAE3BmC,cAAc;AAAA"}
|
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { exec } from 'teen_process';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { node } from 'appium/support';
|
|
4
|
+
|
|
5
|
+
const MODULE_NAME = 'appium-mac2-driver';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Calculates the path to the current module's root folder
|
|
@@ -10,20 +11,11 @@ import _fs from 'fs';
|
|
|
10
11
|
* @throws {Error} If the current module root folder cannot be determined
|
|
11
12
|
*/
|
|
12
13
|
const getModuleRoot = _.memoize(function getModuleRoot () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const manifestPath = path.join(currentDir, 'package.json');
|
|
17
|
-
try {
|
|
18
|
-
if (_fs.existsSync(manifestPath) &&
|
|
19
|
-
JSON.parse(_fs.readFileSync(manifestPath, 'utf8')).name === 'appium-mac2-driver') {
|
|
20
|
-
return currentDir;
|
|
21
|
-
}
|
|
22
|
-
} catch (ign) {}
|
|
23
|
-
currentDir = path.dirname(currentDir);
|
|
24
|
-
isAtFsRoot = currentDir.length <= path.dirname(currentDir).length;
|
|
14
|
+
const root = node.getModuleRootSync(MODULE_NAME, __filename);
|
|
15
|
+
if (!root) {
|
|
16
|
+
throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
|
|
25
17
|
}
|
|
26
|
-
|
|
18
|
+
return root;
|
|
27
19
|
});
|
|
28
20
|
|
|
29
21
|
/**
|