diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ff5cf40f5..000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -WebDriverAgent -coverage -build -site diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 950cea2f1..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": ["@appium/eslint-config-appium-ts"], - "overrides": [ - { - "files": "test/**/*.js", - "rules": { - "func-names": "off", - "@typescript-eslint/no-var-requires": "off" - } - }, - { - "files": "scripts/**/*", - "parserOptions": {"sourceType": "script"}, - "rules": { - "@typescript-eslint/no-var-requires": "off" - } - } - ], - "rules": { - "require-await": "error" - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..08011bc20 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,10 @@ +import appiumConfig from '@appium/eslint-config-appium-ts'; + +export default [ + ...appiumConfig, + { + ignores: [ + 'docs/**', + ], + }, +]; diff --git a/lib/commands/appearance.js b/lib/commands/appearance.js index 85376d427..b9290c775 100644 --- a/lib/commands/appearance.js +++ b/lib/commands/appearance.js @@ -53,7 +53,7 @@ export default { style = /** @type {Style} */ ( await /** @type {import('../driver').Simulator} */ (this.device).getAppearance() ); - } catch (ign) {} + } catch {} } if (!style) { style = /** @type {Style} */ ( diff --git a/lib/commands/certificate.js b/lib/commands/certificate.js index baf9768e2..ce77cff87 100644 --- a/lib/commands/certificate.js +++ b/lib/commands/certificate.js @@ -140,7 +140,7 @@ async function clickElement(driver, locator, options = {}) { lookupDelay, () => driver.findNativeElementOrElements(locator.type, locator.value, false), ); - } catch (err) { + } catch { if (skipIfInvisible) { return false; } @@ -362,7 +362,7 @@ export default { async () => { try { return (await checkPortStatus(tmpPort, host)) === 'open'; - } catch (ign) { + } catch { return false; } }, @@ -372,7 +372,7 @@ export default { }, ); this.log.debug(`The temporary web server is running at http://${host}:${tmpPort}`); - } catch (e) { + } catch { throw new Error( `The temporary web server cannot be started at http://${host}:${tmpPort}.`, ); diff --git a/lib/commands/context.js b/lib/commands/context.js index ff3492147..e23a83cac 100644 --- a/lib/commands/context.js +++ b/lib/commands/context.js @@ -1,7 +1,7 @@ import {createRemoteDebugger, RemoteDebugger} from 'appium-remote-debugger'; import {errors, isErrorType} from 'appium/driver'; import {util, timing} from 'appium/support'; -import IOSPerformanceLog from '../device-log/ios-performance-log'; +import {IOSPerformanceLog} from '../device-log/ios-performance-log'; import _ from 'lodash'; import { NATIVE_WIN } from '../utils'; import { @@ -478,7 +478,6 @@ const commands = { * @this {XCUITestDriver} * @returns {Promise} */ - // eslint-disable-next-line require-await async getCurrentContext() { if (this.curContext && this.curContext !== NATIVE_WIN) { return `${WEBVIEW_BASE}${this.curContext}`; @@ -638,7 +637,6 @@ const commands = { * @this {XCUITestDriver} * @returns {Promise} */ - // eslint-disable-next-line require-await async getWindowHandle() { if (!this.isWebContext()) { // https://github.com/appium/appium/issues/20710 @@ -701,7 +699,7 @@ function isUrlIgnored(url, safariIgnoreWebHostnames) { if (hostname === ignoredHost) { return true; } - } catch (ign) { + } catch { // do nothing if invalid URL } } diff --git a/lib/commands/execute.js b/lib/commands/execute.js index 958c6d0f4..7d53882f5 100644 --- a/lib/commands/execute.js +++ b/lib/commands/execute.js @@ -78,7 +78,6 @@ export default { * @deprecated * @privateRemarks It's unclear what this is for. Don't use it. */ - // eslint-disable-next-line require-await async receiveAsyncResponse(status, value) { this.log.debug(`Received async response: ${JSON.stringify(value)}`); if (!util.hasValue(this.asyncPromise)) { diff --git a/lib/commands/find.js b/lib/commands/find.js index 0e9a809de..4dc084b30 100644 --- a/lib/commands/find.js +++ b/lib/commands/find.js @@ -122,7 +122,7 @@ export default { els = /** @type {Element[]|undefined} */ ( await this.proxyCommand(endpoint, method, body) ); - } catch (err) { + } catch { els = []; } // we succeed if we get some elements @@ -162,7 +162,6 @@ export default { // error, when the index gets higher than the number of child elements. This // is what we want because that error will halt the loop and make it all the // way to the client. - // eslint-disable-next-line no-constant-condition while (true) { const strategy = WDA_CLASS_CHAIN_STRATEGY; const selector = `*[${index}]`; diff --git a/lib/commands/general.js b/lib/commands/general.js index 13cf35ad6..b3260cadf 100644 --- a/lib/commands/general.js +++ b/lib/commands/general.js @@ -135,7 +135,6 @@ const commands = { /** * @this {XCUITestDriver} */ - // eslint-disable-next-line require-await async launchApp() { throw new Error( `The launchApp API has been deprecated and is not supported anymore. ` + @@ -145,7 +144,6 @@ const commands = { /** * @this {XCUITestDriver} */ - // eslint-disable-next-line require-await async closeApp() { throw new Error( `The closeApp API has been deprecated and is not supported anymore. ` + diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index 1ca5f83b3..b06e7eb5a 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -93,7 +93,6 @@ const commands = { /** * @this {XCUITestDriver} */ - // eslint-disable-next-line require-await async releaseActions() { this.log.warn('On this platform, releaseActions is a no-op'); }, diff --git a/lib/commands/keyboard.js b/lib/commands/keyboard.js index 90ac19369..5626d72aa 100644 --- a/lib/commands/keyboard.js +++ b/lib/commands/keyboard.js @@ -30,7 +30,7 @@ export default { try { await this.findNativeElementOrElements('class name', 'XCUIElementTypeKeyboard', false); return true; - } catch (ign) { + } catch { return false; } }, diff --git a/lib/commands/log.js b/lib/commands/log.js index 5210456cc..566a98adf 100644 --- a/lib/commands/log.js +++ b/lib/commands/log.js @@ -5,8 +5,8 @@ import {IOSCrashLog} from '../device-log/ios-crash-log'; import {IOSSimulatorLog} from '../device-log/ios-simulator-log'; import {IOSDeviceLog} from '../device-log/ios-device-log'; import WebSocket from 'ws'; -import SafariConsoleLog from '../device-log/safari-console-log'; -import SafariNetworkLog from '../device-log/safari-network-log'; +import { SafariConsoleLog } from '../device-log/safari-console-log'; +import { SafariNetworkLog } from '../device-log/safari-network-log'; import { toLogEntry } from '../device-log/helpers'; import { NATIVE_WIN } from '../utils'; import { BIDI_EVENT_NAME } from './bidi/constants'; diff --git a/lib/commands/navigation.js b/lib/commands/navigation.js index 5d6d827ec..d7f353b60 100644 --- a/lib/commands/navigation.js +++ b/lib/commands/navigation.js @@ -47,7 +47,7 @@ const commands = { waitMs: CLOSE_WINDOW_TIMEOUT, intervalMs: CLOSE_WINDOW_INTERVAL, }); - } catch (ign) { + } catch { this.log.debug('Context has not yet been changed after closing window. Continuing...'); } } diff --git a/lib/commands/performance.js b/lib/commands/performance.js index cdf113335..f5bfb960f 100644 --- a/lib/commands/performance.js +++ b/lib/commands/performance.js @@ -37,7 +37,7 @@ async function requireXctrace() { async function requireInstruments() { try { return await fs.which(INSTRUMENTS); - } catch (e) { + } catch { throw new Error( `${INSTRUMENTS} has not been found in PATH. ` + `Please make sure XCode development tools are installed`, @@ -106,7 +106,7 @@ export class PerfRecorder { this._logger.debug('Force-stopping the currently running perf recording'); try { await this._process.stop('SIGKILL'); - } catch (ign) {} + } catch {} } this._process = null; const performCleanup = async () => { @@ -121,14 +121,15 @@ export class PerfRecorder { } }; if (this._archivePromise) { - this._archivePromise - // eslint-disable-next-line promise/prefer-await-to-then - .finally(async () => { + (async () => { + try { + await this._archivePromise; + } catch { + } finally { await performCleanup(); this._archivePromise = null; - }) - // eslint-disable-next-line promise/prefer-await-to-then, @typescript-eslint/no-empty-function - .catch(() => {}); + } + })(); } await performCleanup(); return ''; @@ -219,7 +220,7 @@ export class PerfRecorder { intervalMs: 500, }, ); - } catch (e) { + } catch { await this._enforceTermination(); const listProfilesCommand = toolName === XCTRACE ? `${XCRUN} ${XCTRACE} list templates` : `${INSTRUMENTS} -s`; @@ -245,7 +246,7 @@ export class PerfRecorder { try { await this._process?.stop('SIGINT', STOP_TIMEOUT_MS); - } catch (e) { + } catch { throw this._logger.errorWithException( `Performance recording has failed to exit after ${STOP_TIMEOUT_MS}ms`, ); diff --git a/lib/commands/record-audio.js b/lib/commands/record-audio.js index 561c6557a..7cd2add9e 100644 --- a/lib/commands/record-audio.js +++ b/lib/commands/record-audio.js @@ -23,7 +23,7 @@ export class AudioRecorder { async start(timeoutSeconds) { try { await fs.which(FFMPEG_BINARY); - } catch (err) { + } catch { throw new Error( `'${FFMPEG_BINARY}' binary is not found in PATH. Install it using 'brew install ffmpeg'. ` + `Check https://www.ffmpeg.org/download.html for more details.`, @@ -69,7 +69,7 @@ export class AudioRecorder { waitMs: PROCESS_STARTUP_TIMEOUT_MS, intervalMs: 300, }); - } catch (e) { + } catch { this.log.warn( `Audio recording process did not start within ${PROCESS_STARTUP_TIMEOUT_MS}ms. Continuing anyway`, ); diff --git a/lib/commands/recordscreen.js b/lib/commands/recordscreen.js index 569c1631d..b26371515 100644 --- a/lib/commands/recordscreen.js +++ b/lib/commands/recordscreen.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import {fs, tempDir, logger, util} from 'appium/support'; import {SubProcess} from 'teen_process'; import {encodeBase64OrUpload, isLocalHost} from '../utils'; -import DEVICE_CONNECTIONS_FACTORY from '../device-connections-factory'; +import {DEVICE_CONNECTIONS_FACTORY} from '../device-connections-factory'; import {WDA_BASE_URL} from 'appium-webdriveragent'; import {waitForCondition} from 'asyncbox'; import url from 'url'; @@ -42,7 +42,7 @@ export class ScreenRecorder { async start(timeoutMs) { try { await fs.which(FFMPEG_BINARY); - } catch (err) { + } catch { throw new Error( `'${FFMPEG_BINARY}' binary is not found in PATH. Install it using 'brew install ffmpeg'. ` + `Check https://www.ffmpeg.org/download.html for more details.`, @@ -65,7 +65,7 @@ export class ScreenRecorder { devicePort: remotePort, usePortForwarding, }); - } catch (err) { + } catch { this.log.warn( `Cannot forward the local port ${remotePort} to ${remotePort} ` + `on the device ${this.udid}. Set the custom value to 'mjpegServerPort' ` + @@ -119,7 +119,7 @@ export class ScreenRecorder { waitMs: startupTimeout, intervalMs: 300, }); - } catch (e) { + } catch { this.log.warn( `Screen capture process did not start within ${startupTimeout}ms. Continuing anyway`, ); diff --git a/lib/commands/web.js b/lib/commands/web.js index 28b0282ac..f23337609 100644 --- a/lib/commands/web.js +++ b/lib/commands/web.js @@ -1,9 +1,9 @@ import {errors, isErrorType} from 'appium/driver'; import {timing, util} from 'appium/support'; import {retryInterval} from 'asyncbox'; -import B from 'bluebird'; +import B, {TimeoutError, AggregateError} from 'bluebird'; import _ from 'lodash'; -import cookieUtils from '../cookies'; +import * as cookieUtils from '../cookies'; const IPHONE_TOP_BAR_HEIGHT = 71; const IPHONE_SCROLLED_TOP_BAR_HEIGHT = 41; @@ -702,7 +702,7 @@ const extensions = { await this.findNativeElementOrElements('class name', 'XCUIElementTypeWebView', false), ) ); - } catch (ign) {} + } catch {} if (!webview) { throw new Error(`No WebView found. Unable to translate web coordinates for native web tap.`); @@ -783,9 +783,9 @@ const extensions = { try { return await p; } catch (err) { - const originalError = err instanceof B.AggregateError ? err[0] : err; + const originalError = err instanceof AggregateError ? err[0] : err; this.log.debug(`Error received while executing atom: ${originalError.message}`); - if (originalError instanceof B.TimeoutError) { + if (originalError instanceof TimeoutError) { throw new errors.TimeoutError( `Did not get any response for atom execution after ` + `${timer.getDuration().asMilliSeconds.toFixed(0)}ms`, @@ -833,7 +833,6 @@ const extensions = { this._waitingAtoms.alertNotifier.once(ON_OBSTRUCTING_ALERT_EVENT, onAlertCallback); this._waitingAtoms.alertNotifier.once(ON_APP_CRASH_EVENT, onAppCrashCallback); handlePromiseError(timedAtomPromise) - // eslint-disable-next-line promise/prefer-await-to-then .then(resolve) .catch(reject); }); diff --git a/lib/commands/xctest.js b/lib/commands/xctest.js index eec8d8863..338a0bced 100644 --- a/lib/commands/xctest.js +++ b/lib/commands/xctest.js @@ -199,10 +199,11 @@ export default { if (stderr) { lastErrorMessage = stderr; + xctestLog.error(stderr); + } + if (stdout) { + xctestLog.info(stdout); } - - stdout && xctestLog.info(stdout); - stderr && xctestLog.error(stderr); }); subproc.on('exit', (code, signal) => { diff --git a/lib/device-connections-factory.js b/lib/device-connections-factory.js index cede3d542..310cf484f 100644 --- a/lib/device-connections-factory.js +++ b/lib/device-connections-factory.js @@ -195,7 +195,7 @@ class DeviceConnectionsFactory { isPortBusy = false; return true; } - } catch (ign) {} + } catch {} return false; }, { @@ -203,7 +203,7 @@ class DeviceConnectionsFactory { intervalMs: 300, }, ); - } catch (ign) { + } catch { log.warn( `Did not know how to release port #${port} in ` + `${timer.getDuration().asMilliSeconds.toFixed(0)}ms`, diff --git a/lib/device-log/ios-crash-log.ts b/lib/device-log/ios-crash-log.ts index cdbcede9b..8dbde4229 100644 --- a/lib/device-log/ios-crash-log.ts +++ b/lib/device-log/ios-crash-log.ts @@ -3,7 +3,7 @@ import B from 'bluebird'; import path from 'path'; import _ from 'lodash'; import {Pyidevice} from '../real-device-clients/py-ios-device-client'; -import IOSLog from './ios-log'; +import {IOSLog} from './ios-log'; import { toLogEntry, grepFile } from './helpers'; import type { AppiumLogger } from '@appium/types'; import type { BaseDeviceClient } from '../real-device-clients/base-device-client'; @@ -59,7 +59,6 @@ export class IOSCrashLog extends IOSLog { this._started = true; } - // eslint-disable-next-line require-await override async stopCapture(): Promise { this._started = false; } diff --git a/lib/device-log/ios-device-log.ts b/lib/device-log/ios-device-log.ts index d53bf3981..cf42c9fb6 100644 --- a/lib/device-log/ios-device-log.ts +++ b/lib/device-log/ios-device-log.ts @@ -32,7 +32,6 @@ export class IOSDeviceLog extends LineConsumingLog { return !!this.service; } - // eslint-disable-next-line require-await override async stopCapture(): Promise { if (!this.service) { return; diff --git a/lib/device-log/ios-log.ts b/lib/device-log/ios-log.ts index 27a012571..ab45dbe29 100644 --- a/lib/device-log/ios-log.ts +++ b/lib/device-log/ios-log.ts @@ -37,7 +37,6 @@ export abstract class IOSLog< return this._log; } - // eslint-disable-next-line require-await async getLogs(): Promise { const result: LogEntry[] = []; for (const value of this.logs.rvalues()) { diff --git a/lib/device-log/ios-simulator-log.ts b/lib/device-log/ios-simulator-log.ts index 0a58ba313..73a5359be 100644 --- a/lib/device-log/ios-simulator-log.ts +++ b/lib/device-log/ios-simulator-log.ts @@ -90,7 +90,7 @@ export class IOSSimulatorLog extends LineConsumingLog { this.log.debug('Stopping iOS log capture'); try { await this.proc.stop('SIGTERM', 1000); - } catch (e) { + } catch { if (!this.proc.isRunning) { return; } diff --git a/lib/device-log/safari-console-log.ts b/lib/device-log/safari-console-log.ts index 9cf6ef3c8..b8cb27f32 100644 --- a/lib/device-log/safari-console-log.ts +++ b/lib/device-log/safari-console-log.ts @@ -6,7 +6,7 @@ import { MAX_JSON_LOG_LENGTH, MAX_BUFFERED_EVENTS_COUNT } from './helpers'; -import IOSLog from './ios-log'; +import { IOSLog } from './ios-log'; import type { LogEntry } from '../commands/types'; const LOG_LEVELS_MAP = { diff --git a/lib/doctor/optional-checks.js b/lib/doctor/optional-checks.js index 03f7ee29d..51749de9a 100644 --- a/lib/doctor/optional-checks.js +++ b/lib/doctor/optional-checks.js @@ -1,4 +1,3 @@ -/* eslint-disable require-await */ import {resolveExecutablePath} from './utils'; import {doctor} from 'appium/support'; import '@colors/colors'; diff --git a/lib/doctor/required-checks.js b/lib/doctor/required-checks.js index 8d49da49c..a7e4b8507 100644 --- a/lib/doctor/required-checks.js +++ b/lib/doctor/required-checks.js @@ -1,4 +1,3 @@ -/* eslint-disable require-await */ import {fs, doctor} from 'appium/support'; import {exec} from 'teen_process'; import { getPath as getXcodePath } from 'appium-xcode'; diff --git a/lib/doctor/utils.js b/lib/doctor/utils.js index 3bc6b6371..44d170049 100644 --- a/lib/doctor/utils.js +++ b/lib/doctor/utils.js @@ -12,6 +12,6 @@ export async function resolveExecutablePath(cmd) { if (executablePath && (await fs.exists(executablePath))) { return executablePath; } - } catch (err) {} + } catch {} return null; } diff --git a/lib/driver.js b/lib/driver.js index b1a632771..49a602b83 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -20,7 +20,7 @@ import { } from './app-utils'; import commands from './commands'; import {desiredCapConstraints} from './desired-caps'; -import DEVICE_CONNECTIONS_FACTORY from './device-connections-factory'; +import {DEVICE_CONNECTIONS_FACTORY} from './device-connections-factory'; import {executeMethodMap} from './execute-method-map'; import {newMethodMap} from './method-map'; import { Pyidevice } from './real-device-clients/py-ios-device-client'; @@ -856,7 +856,7 @@ export class XCUITestDriver extends BaseDriver { // In case the bundle id process start got failed because of // auth popup in the device. Then, the bundle id process itself started. It is safe to stop it here. await this.mobileKillApp(this.wda.bundleIdForXctest); - } catch (ign) {}; + } catch {}; // Mostly it failed to start the WDA process as no the bundle id // e.g. ' not found on device ' @@ -983,7 +983,7 @@ export class XCUITestDriver extends BaseDriver { if (shouldResetLocationServivce) { try { await this.mobileResetLocationService(); - } catch (ignore) { + } catch { /* Ignore this error since mobileResetLocationService already logged the error */ } } @@ -1694,7 +1694,6 @@ export class XCUITestDriver extends BaseDriver { /** * Reset the current session (run the delete session and create session subroutines) */ - // eslint-disable-next-line require-await async reset() { throw new Error( `The reset API has been deprecated and is not supported anymore. ` + diff --git a/lib/ios-fs-helpers.js b/lib/ios-fs-helpers.js index 3aecaeeb4..45ccdd8d9 100644 --- a/lib/ios-fs-helpers.js +++ b/lib/ios-fs-helpers.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import B from 'bluebird'; +import B, {TimeoutError} from 'bluebird'; import {fs, tempDir, mkdirp, zip, util, timing} from 'appium/support'; import path from 'path'; import log from './logger'; @@ -38,7 +38,7 @@ export async function pullFile(afcService, remotePath) { async function folderExists(folderPath) { try { return (await fs.stat(folderPath)).isDirectory(); - } catch (e) { + } catch { return false; } } @@ -137,7 +137,7 @@ async function remoteMkdirp(afcService, remoteRoot) { try { await afcService.listDirectory(remoteRoot); return; - } catch (e) { + } catch { // This means that the directory is missing and we got an object not found error. // Therefore, we are going to the parent await remoteMkdirp(afcService, path.dirname(remoteRoot)); @@ -261,7 +261,7 @@ export async function pushFolder(afcService, srcRootPath, dstRootPath, opts = {} // create the folder structure first try { await afcService.deleteDirectory(dstRootPath); - } catch (ign) {} + } catch {} await afcService.createDirectory(dstRootPath); for (const relativeFolderPath of foldersToPush) { // createDirectory does not accept folder names ending with a path separator @@ -315,7 +315,7 @@ export async function pushFolder(afcService, srcRootPath, dstRootPath, opts = {} await B.any(pushPromises); const elapsedMs = timer.getDuration().asMilliSeconds; if (elapsedMs > timeoutMs) { - throw new B.TimeoutError(`Timed out after ${elapsedMs} ms`); + throw new TimeoutError(`Timed out after ${elapsedMs} ms`); } } _.remove(pushPromises, (p) => p.isFulfilled()); @@ -330,7 +330,7 @@ export async function pushFolder(afcService, srcRootPath, dstRootPath, opts = {} await _pushFile(relativeFilePath); const elapsedMs = timer.getDuration().asMilliSeconds; if (elapsedMs > timeoutMs) { - throw new B.TimeoutError(`Timed out after ${elapsedMs} ms`); + throw new TimeoutError(`Timed out after ${elapsedMs} ms`); } } } diff --git a/lib/real-device-clients/py-ios-device-client.ts b/lib/real-device-clients/py-ios-device-client.ts index 8c1f03ca9..a52c28795 100644 --- a/lib/real-device-clients/py-ios-device-client.ts +++ b/lib/real-device-clients/py-ios-device-client.ts @@ -40,7 +40,7 @@ export class Pyidevice extends BaseDeviceClient { try { this._binaryPath = await fs.which(BINARY_NAME); return true; - } catch (e) { + } catch { if (isStrict) { throw new Error( `${BINARY_NAME} binary cannot be found in PATH. ` + diff --git a/lib/real-device.js b/lib/real-device.js index af1998bfa..4bafba02f 100644 --- a/lib/real-device.js +++ b/lib/real-device.js @@ -1,7 +1,7 @@ import {timing, util, fs} from 'appium/support'; import path from 'path'; import {services, utilities, INSTRUMENT_CHANNEL} from 'appium-ios-device'; -import B from 'bluebird'; +import B, {TimeoutError} from 'bluebird'; import defaultLogger from './logger'; import _ from 'lodash'; import {SAFARI_BUNDLE_ID} from './app-utils'; @@ -104,7 +104,7 @@ export class RealDevice { } catch (err) { this.log.debug(err.stack); let errMessage = `Cannot install the ${bundleId} application`; - if (err instanceof B.TimeoutError) { + if (err instanceof TimeoutError) { errMessage += `. Consider increasing the value of 'appPushTimeout' capability (the current value equals to ${timeoutMs}ms)`; } errMessage += `. Original error: ${err.message}`; diff --git a/lib/simulator-management.js b/lib/simulator-management.js index cf60171f9..a9a72bb90 100644 --- a/lib/simulator-management.js +++ b/lib/simulator-management.js @@ -1,5 +1,5 @@ import {getSimulator} from 'appium-ios-simulator'; -import Simctl from 'node-simctl'; +import {Simctl} from 'node-simctl'; import {resetTestProcesses} from 'appium-webdriveragent'; import _ from 'lodash'; import {util, timing} from 'appium/support'; @@ -24,7 +24,7 @@ export async function createSim() { deviceNames = (await simctl .getDevices(platformVersion, platform)) .map(({deviceName}) => deviceName); - } catch (ign) {} + } catch {} throw new Error( `'deviceName' must be provided in order to create a new Simulator for ${platform} platform. ` + `Currently available device names: ${deviceNames}`, @@ -179,7 +179,7 @@ export async function runSimulatorReset(enforceSimulatorShutdown = false) { // Terminate the app under test if it is still running on Simulator try { await device.terminateApp(bundleId); - } catch (err) { + } catch { this.log.warn(`Reset: failed to terminate Simulator application with id "${bundleId}"`); } diff --git a/lib/utils.js b/lib/utils.js index 7e811d3e2..6d2b26728 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,4 +1,4 @@ -import xcode from 'appium-xcode'; +import * as xcode from 'appium-xcode'; import {errors} from 'appium/driver'; import {fs, net, util} from 'appium/support'; import B from 'bluebird'; @@ -6,7 +6,7 @@ import _ from 'lodash'; import os from 'node:os'; import path from 'node:path'; import url from 'node:url'; -import semver from 'semver'; +import * as semver from 'semver'; import {exec} from 'teen_process'; import iosGenericSimulators from './ios-generic-simulators'; import log from './logger'; @@ -123,7 +123,7 @@ async function clearLogs(locations) { try { const {stdout} = await exec('du', ['-sh', location]); size = stdout.trim().split(/\s+/)[0]; - } catch (ign) {} + } catch {} try { log.debug(`Deleting '${location}'. ${size ? `Freeing ${size}.` : ''}`); await fs.rimraf(location); @@ -248,7 +248,7 @@ const getModuleManifest = _.memoize(async function getModuleManifest() { return manifest; } } - } catch (ign) {} + } catch {} currentDir = path.dirname(currentDir); isAtFsRoot = currentDir.length <= path.dirname(currentDir).length; } @@ -294,7 +294,7 @@ function normalizeCommandTimeouts(value) { if (!_.isPlainObject(result)) { throw new Error(); } - } catch (err) { + } catch { throw log.errorWithException( `"commandTimeouts" capability should be a valid JSON object. "${value}" was given instead`, ); @@ -337,7 +337,7 @@ async function getPIDsListeningOnPort(port, filteringFunc = null) { // This only works since Mac OS X El Capitan const {stdout} = await exec('lsof', ['-ti', `tcp:${port}`]); result.push(...stdout.trim().split(/\n+/)); - } catch (e) { + } catch { return result; } @@ -428,7 +428,7 @@ function isLocalHost(urlString) { try { const hostname = /** @type {string} */ (url.parse(urlString).hostname); return ['localhost', '127.0.0.1', '::1', '::ffff:127.0.0.1'].includes(hostname); - } catch (ign) { + } catch { log.warn(`'${urlString}' cannot be parsed as a valid URL`); } return false; diff --git a/lib/xcrun.js b/lib/xcrun.js index 7b1822d0c..a82b2da46 100644 --- a/lib/xcrun.js +++ b/lib/xcrun.js @@ -5,7 +5,7 @@ const XCRUN = 'xcrun'; async function requireXcrun() { try { return await fs.which(XCRUN); - } catch (e) { + } catch { throw new Error( `${XCRUN} has not been found in PATH. ` + `Please make sure XCode development tools are installed`, diff --git a/package.json b/package.json index 16ea68c66..e19a4fc65 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ }, "devDependencies": { "@appium/docutils": "^1.0.2", - "@appium/eslint-config-appium-ts": "^0.x", + "@appium/eslint-config-appium-ts": "^1.0.0", "@appium/test-support": "^3.0.20", "@appium/tsconfig": "^0.x", "@appium/types": "^0.x", diff --git a/test/env/env-ios-real.js b/test/env/env-ios-real.js index a08136e9b..40f5ac12e 100644 --- a/test/env/env-ios-real.js +++ b/test/env/env-ios-real.js @@ -1,6 +1,6 @@ import moment from 'moment'; import envBase from './env-base'; -import log from './logger'; +import {log} from './logger'; const platforms = ['10', '11', '10.3', '11.3', '11.4']; diff --git a/test/env/env-ios-sim.js b/test/env/env-ios-sim.js index f77bf6436..509d03515 100644 --- a/test/env/env-ios-sim.js +++ b/test/env/env-ios-sim.js @@ -2,7 +2,7 @@ import moment from 'moment'; import _ from 'lodash'; import envBase from './env-base'; import platformDefinition from './ios-sim-platforms'; -import log from './logger'; +import { log } from './logger'; const platforms = []; diff --git a/test/env/logger.js b/test/env/logger.js index debaee693..06413e11b 100644 --- a/test/env/logger.js +++ b/test/env/logger.js @@ -1,6 +1,5 @@ import {logger} from 'appium/support'; -const log = logger.getLogger('TEST RUNNER'); +export const log = logger.getLogger('TEST RUNNER'); -export {log}; export default log; diff --git a/test/functional/basic/alert-e2e-specs.js b/test/functional/basic/alert-e2e-specs.js index a1b25f99a..926406615 100644 --- a/test/functional/basic/alert-e2e-specs.js +++ b/test/functional/basic/alert-e2e-specs.js @@ -37,7 +37,7 @@ describe('XCUITestDriver - alerts -', function () { afterEach(async function () { try { await driver.dismissAlert(); - } catch (ign) {} + } catch {} await driver.back(); }); diff --git a/test/functional/basic/basic-e2e-specs.js b/test/functional/basic/basic-e2e-specs.js index 1b6328696..336160a55 100644 --- a/test/functional/basic/basic-e2e-specs.js +++ b/test/functional/basic/basic-e2e-specs.js @@ -87,7 +87,7 @@ describe('XCUITestDriver - basics -', function () { after(async function () { try { await driver.setOrientation('PORTRAIT'); - } catch (ign) {} + } catch {} }); it('should get an app screenshot', async function () { let screenshot = await driver.takeScreenshot(); @@ -105,7 +105,7 @@ describe('XCUITestDriver - basics -', function () { try { await driver.setOrientation('LANDSCAPE'); - } catch (ign) {} + } catch {} // take a little pause while it orients, otherwise you get the screenshot // on an angle await B.delay(500); diff --git a/test/functional/basic/face-id-e2e-specs.js b/test/functional/basic/face-id-e2e-specs.js index 85d60690d..1c4b5f0e2 100644 --- a/test/functional/basic/face-id-e2e-specs.js +++ b/test/functional/basic/face-id-e2e-specs.js @@ -63,7 +63,7 @@ if (!process.env.CI) { waitMs: timeout, intervalMs: 300, }); - } catch (e) { + } catch { throw new Error( `Element located by '${locator}' done not exist after ${timeout}ms timeout`, ); diff --git a/test/functional/basic/find-e2e-specs.js b/test/functional/basic/find-e2e-specs.js index 269676911..869fc92d1 100644 --- a/test/functional/basic/find-e2e-specs.js +++ b/test/functional/basic/find-e2e-specs.js @@ -141,7 +141,7 @@ describe('XCUITestDriver - find -', function () { // and make sure we are at the top of the page try { await driver.execute('mobile: scroll', {direction: 'up'}); - } catch (ign) {} + } catch {} }); beforeEach(async function () { // go into the right page @@ -191,7 +191,7 @@ describe('XCUITestDriver - find -', function () { let el; try { el = await driver.$('//XCUIElementTypeNavigationBar/XCUIElementTypeStaticText'); - } catch (err) { + } catch { el = await driver.$('//XCUIElementTypeNavigationBar/XCUIElementTypeOther'); } (await el.getAttribute('name')).should.equal('Buttons'); @@ -319,7 +319,7 @@ describe('XCUITestDriver - find -', function () { try { const el = await driver.$('~Text Fields'); await driver.execute('mobile: scroll', {element: el.elementId, toVisible: true}); - } catch (ign) {} + } catch {} }); afterEach(async function () { await driver.back(); diff --git a/test/functional/basic/touch-id-e2e-specs.js b/test/functional/basic/touch-id-e2e-specs.js index 66e00f213..2690f6764 100644 --- a/test/functional/basic/touch-id-e2e-specs.js +++ b/test/functional/basic/touch-id-e2e-specs.js @@ -61,7 +61,7 @@ if (!process.env.CI) { waitMs: timeout, intervalMs: 300, }); - } catch (e) { + } catch { throw new Error( `Element located by '${locator}' done not exist after ${timeout}ms timeout`, ); diff --git a/test/functional/device/accessibility-e2e-specs.js b/test/functional/device/accessibility-e2e-specs.js index 141fd0f30..7562cb672 100644 --- a/test/functional/device/accessibility-e2e-specs.js +++ b/test/functional/device/accessibility-e2e-specs.js @@ -49,7 +49,7 @@ describe('Accessibility', function () { await driver .$(`${PREDICATE_SEARCH}:type == 'XCUIElementTypeCell' AND name == 'Accessibility'`) .click(); - } catch (err) { + } catch { await driver .$(`${PREDICATE_SEARCH}:type == 'XCUIElementTypeCell' AND name == 'General'`) .click(); diff --git a/test/functional/driver/driver-e2e-specs.js b/test/functional/driver/driver-e2e-specs.js index 90e28ce8b..826d197d0 100644 --- a/test/functional/driver/driver-e2e-specs.js +++ b/test/functional/driver/driver-e2e-specs.js @@ -1,7 +1,7 @@ import {retryInterval} from 'asyncbox'; import {getSimulator} from 'appium-ios-simulator'; import {killAllSimulators, deleteDeviceWithRetry, cleanupSimulator} from '../helpers/simulator'; -import Simctl from 'node-simctl'; +import {Simctl} from 'node-simctl'; import B from 'bluebird'; import {MOCHA_TIMEOUT, initSession, deleteSession, HOST} from '../helpers/session'; import { diff --git a/test/functional/helpers/session.js b/test/functional/helpers/session.js index ba3a8b2f2..0f3cbb835 100644 --- a/test/functional/helpers/session.js +++ b/test/functional/helpers/session.js @@ -39,7 +39,7 @@ async function initSession(caps, remoteOpts = {}) { async function deleteSession() { try { await driver.deleteSession(); - } catch (ign) { + } catch { } finally { driver = undefined; } diff --git a/test/functional/helpers/simulator.js b/test/functional/helpers/simulator.js index 64c92c193..ab5096dbf 100644 --- a/test/functional/helpers/simulator.js +++ b/test/functional/helpers/simulator.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import Simctl from 'node-simctl'; +import {Simctl} from 'node-simctl'; import {retryInterval} from 'asyncbox'; import {resetTestProcesses} from 'appium-webdriveragent'; import {shutdownSimulator} from '../../../lib/simulator-management'; @@ -27,7 +27,7 @@ export async function deleteDeviceWithRetry(udid) { const simctl = new Simctl({udid}); try { await retryInterval(10, 1000, simctl.deleteDevice.bind(simctl)); - } catch (ign) {} + } catch {} } /** diff --git a/test/functional/tv/tvos-e2e-specs.js b/test/functional/tv/tvos-e2e-specs.js index 2ae850c00..169f154c5 100644 --- a/test/functional/tv/tvos-e2e-specs.js +++ b/test/functional/tv/tvos-e2e-specs.js @@ -1,6 +1,6 @@ import {getSimulator} from 'appium-ios-simulator'; import {cleanupSimulator} from '../helpers/simulator'; -import Simctl from 'node-simctl'; +import {Simctl} from 'node-simctl'; import {MOCHA_TIMEOUT, initSession, deleteSession} from '../helpers/session'; import {TVOS_CAPS} from '../desired'; diff --git a/test/functional/web/safari-basic-e2e-specs.js b/test/functional/web/safari-basic-e2e-specs.js index 04e81fcb7..2fe642dc6 100644 --- a/test/functional/web/safari-basic-e2e-specs.js +++ b/test/functional/web/safari-basic-e2e-specs.js @@ -213,12 +213,6 @@ describe('Safari - basics -', function () { await el.setValue('hello world'); ['how world', 'hello world'].should.include((await el.getAttribute('value')).toLowerCase()); }); - }); - describe('element handling', function () { - beforeEach(async function () { - await openPage(driver, GUINEA_PIG_PAGE); - }); - it('should send keystrokes to active element', async function () { const el = await driver.$('#comments'); await el.click(); diff --git a/test/functional/web/safari-execute-e2e-specs.js b/test/functional/web/safari-execute-e2e-specs.js index bc4715e5b..922bdcb37 100644 --- a/test/functional/web/safari-execute-e2e-specs.js +++ b/test/functional/web/safari-execute-e2e-specs.js @@ -33,7 +33,6 @@ describe('safari - execute -', function () { await deleteSession(); }); - // eslint-disable-next-line require-await async function runTests(secure = false) { describe('mobile: x methods', function () { it('should run in native context', async function () { diff --git a/test/functional/web/safari-nativewebtap-e2e-specs.js b/test/functional/web/safari-nativewebtap-e2e-specs.js index ce8c36e71..df9b63ea9 100644 --- a/test/functional/web/safari-nativewebtap-e2e-specs.js +++ b/test/functional/web/safari-nativewebtap-e2e-specs.js @@ -1,3 +1,5 @@ +/* eslint-disable mocha/no-nested-tests */ + import _ from 'lodash'; import {util} from 'appium/support'; import {initSession, deleteSession, hasDefaultPrebuiltWDA, MOCHA_TIMEOUT} from '../helpers/session'; diff --git a/test/functional/web/safari-window-e2e-specs.js b/test/functional/web/safari-window-e2e-specs.js index 817a69e10..a5c296f3b 100644 --- a/test/functional/web/safari-window-e2e-specs.js +++ b/test/functional/web/safari-window-e2e-specs.js @@ -140,7 +140,7 @@ describe('safari - windows and frames', function () { waitMs: timeout, intervalMs: 300, }); - } catch (e) { + } catch { throw new Error( `Element located by '${locator}' still exists after ${timeout}ms timeout`, ); diff --git a/test/unit/app-utils-specs.js b/test/unit/app-utils-specs.js index ddd5cc504..a13641d17 100644 --- a/test/unit/app-utils-specs.js +++ b/test/unit/app-utils-specs.js @@ -21,7 +21,7 @@ describe('app-utils', function () { it('should unzip from stream', async function () { try { await fs.which('bsdtar'); - } catch (e) { + } catch { return; } @@ -47,7 +47,7 @@ describe('app-utils', function () { it('should fail for invalid archives', async function () { try { await fs.which('bsdtar'); - } catch (e) { + } catch { return; } diff --git a/test/unit/commands/activeAppInfo-specs.js b/test/unit/commands/activeAppInfo-specs.js index 18e978428..8259a9975 100644 --- a/test/unit/commands/activeAppInfo-specs.js +++ b/test/unit/commands/activeAppInfo-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('get activeapp commands', function () { diff --git a/test/unit/commands/alert-specs.js b/test/unit/commands/alert-specs.js index 7aa2b1d19..86277f1a4 100644 --- a/test/unit/commands/alert-specs.js +++ b/test/unit/commands/alert-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('alert commands', function () { diff --git a/test/unit/commands/context-specs.js b/test/unit/commands/context-specs.js index 64b3e245c..5e1bbdb94 100644 --- a/test/unit/commands/context-specs.js +++ b/test/unit/commands/context-specs.js @@ -1,4 +1,4 @@ -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('context', function () { diff --git a/test/unit/commands/deviceinfo-specs.js b/test/unit/commands/deviceinfo-specs.js index fe393acc5..78e012a03 100644 --- a/test/unit/commands/deviceinfo-specs.js +++ b/test/unit/commands/deviceinfo-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('get deviceinfo commands', function () { diff --git a/test/unit/commands/element-specs.js b/test/unit/commands/element-specs.js index 5399752d7..427c78fc7 100644 --- a/test/unit/commands/element-specs.js +++ b/test/unit/commands/element-specs.js @@ -1,6 +1,6 @@ // eslint-disable-next-line import sinon, {createSandbox} from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('element commands', function () { @@ -160,8 +160,6 @@ describe('element commands', function () { beforeEach(function () { oldContext = driver.curContext; - }); - beforeEach(function () { driver.curContext = 'WEBVIEW'; }); afterEach(function () { diff --git a/test/unit/commands/file-movement-specs.js b/test/unit/commands/file-movement-specs.js index c7dd94a28..a254e42a2 100644 --- a/test/unit/commands/file-movement-specs.js +++ b/test/unit/commands/file-movement-specs.js @@ -1,6 +1,6 @@ import {parseContainerPath} from '../../../lib/commands/file-movement'; import {tempDir} from 'appium/support'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('file-movement', function () { diff --git a/test/unit/commands/find-specs.js b/test/unit/commands/find-specs.js index 25b8a8453..6db1af17a 100644 --- a/test/unit/commands/find-specs.js +++ b/test/unit/commands/find-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('general commands', function () { const driver = new XCUITestDriver(); @@ -27,7 +27,7 @@ describe('general commands', function () { async function verifyFind(strategy, selector, modSelector, modStrategy = null, mult = false) { try { await driver.findNativeElementOrElements(strategy, selector, mult); - } catch (ign) {} + } catch {} proxySpy.calledOnceWith(`/element${mult ? 's' : ''}`, 'POST', { using: modStrategy || strategy, value: modSelector, diff --git a/test/unit/commands/general-specs.js b/test/unit/commands/general-specs.js index 7740ed782..e8e91bd93 100644 --- a/test/unit/commands/general-specs.js +++ b/test/unit/commands/general-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; import _ from 'lodash'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('general commands', function () { diff --git a/test/unit/commands/gesture-specs.js b/test/unit/commands/gesture-specs.js index 7dc24d48d..60b1780fc 100644 --- a/test/unit/commands/gesture-specs.js +++ b/test/unit/commands/gesture-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; import {gesturesChainToString} from '../../../lib/commands/gesture'; diff --git a/test/unit/commands/location-specs.js b/test/unit/commands/location-specs.js index 01116db55..91d30fdef 100644 --- a/test/unit/commands/location-specs.js +++ b/test/unit/commands/location-specs.js @@ -1,7 +1,7 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; import {services} from 'appium-ios-device'; -import RealDevice from '../../../lib/real-device'; +import {RealDevice} from '../../../lib/real-device'; describe('location commands', function () { const udid = '1234'; diff --git a/test/unit/commands/pasteboard-specs.js b/test/unit/commands/pasteboard-specs.js index 3092d7a46..5e1f9203f 100644 --- a/test/unit/commands/pasteboard-specs.js +++ b/test/unit/commands/pasteboard-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; -import Simctl from 'node-simctl'; +import {XCUITestDriver} from '../../../lib/driver'; +import {Simctl} from 'node-simctl'; describe('pasteboard commands', function () { const driver = new XCUITestDriver(); diff --git a/test/unit/commands/proxy-helper-specs.js b/test/unit/commands/proxy-helper-specs.js index c3d3fc340..fb80b9abb 100644 --- a/test/unit/commands/proxy-helper-specs.js +++ b/test/unit/commands/proxy-helper-specs.js @@ -1,6 +1,6 @@ import {errors} from 'appium/driver'; import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('proxy commands', function () { diff --git a/test/unit/commands/screenshots-specs.js b/test/unit/commands/screenshots-specs.js index 8b414d557..d22d8c1fc 100644 --- a/test/unit/commands/screenshots-specs.js +++ b/test/unit/commands/screenshots-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; -import Simctl from 'node-simctl'; +import {XCUITestDriver} from '../../../lib/driver'; +import {Simctl} from 'node-simctl'; describe('screenshots commands', function () { let driver; diff --git a/test/unit/commands/session-specs.js b/test/unit/commands/session-specs.js index 3e6edd75c..364e2d65b 100644 --- a/test/unit/commands/session-specs.js +++ b/test/unit/commands/session-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; describe('session commands', function () { let driver = new XCUITestDriver(); @@ -17,7 +17,14 @@ describe('session commands', function () { }); afterEach(function () { - mockDriver.verify(); + try { + mockDriver.verify(); + } finally { + proxySpy.reset(); + for (let stub of otherStubs) { + stub.reset(); + } + } }); driver.opts.udid = 'cecinestpasuneudid'; @@ -43,11 +50,4 @@ describe('session commands', function () { }), sinon.stub(driver, 'getDevicePixelRatio').resolves(3), ]; - - afterEach(function () { - proxySpy.reset(); - for (let stub of otherStubs) { - stub.reset(); - } - }); }); diff --git a/test/unit/commands/simctl-specs.js b/test/unit/commands/simctl-specs.js index e1acf8c37..20a01a966 100644 --- a/test/unit/commands/simctl-specs.js +++ b/test/unit/commands/simctl-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; -import Simctl from 'node-simctl'; +import {XCUITestDriver} from '../../../lib/driver'; +import {Simctl} from 'node-simctl'; describe('general commands', function () { diff --git a/test/unit/commands/source-specs.js b/test/unit/commands/source-specs.js index 5aa1bbeec..5dd98eb80 100644 --- a/test/unit/commands/source-specs.js +++ b/test/unit/commands/source-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../../lib/driver'; +import {XCUITestDriver} from '../../../lib/driver'; const xmlHeader = ''; const xmlBody = ''; @@ -7,7 +7,7 @@ const srcTree = `${xmlHeader}${xmlBody}`; describe('source commands', function () { let driver = new XCUITestDriver(); - let proxyStub = sinon.stub(driver, 'proxyCommand').callsFake(async () => srcTree); // eslint-disable-line require-await + let proxyStub = sinon.stub(driver, 'proxyCommand').callsFake(async () => srcTree); afterEach(function () { proxyStub.resetHistory(); diff --git a/test/unit/driver-specs.js b/test/unit/driver-specs.js index f8d36bacc..c8bb249a3 100644 --- a/test/unit/driver-specs.js +++ b/test/unit/driver-specs.js @@ -3,10 +3,10 @@ import {JWProxy} from 'appium/driver'; import _ from 'lodash'; import {createSandbox} from 'sinon'; import cmds from '../../lib/commands'; -import XCUITestDriver from '../../lib/driver'; +import {XCUITestDriver} from '../../lib/driver'; import * as utils from '../../lib/utils'; import {MOCHA_LONG_TIMEOUT} from './helpers'; -import RealDevice from '../../lib/real-device'; +import {RealDevice} from '../../lib/real-device'; const caps = { @@ -126,7 +126,6 @@ describe('XCUITestDriver', function () { realDevice = null; sandbox .stub(driver, 'determineDevice') - // eslint-disable-next-line require-await .callsFake(async () => ({device, realDevice, udid: 'stuff'})); sandbox.stub(driver, 'configureApp'); sandbox.stub(driver, 'startLogCapture'); diff --git a/test/unit/language-specs.js b/test/unit/language-specs.js index 94e3abaa7..6ee2f3578 100644 --- a/test/unit/language-specs.js +++ b/test/unit/language-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; import _ from 'lodash'; -import XCUITestDriver from '../../lib/driver'; +import {XCUITestDriver} from '../../lib/driver'; describe('language and locale', function () { diff --git a/test/unit/processargs-specs.js b/test/unit/processargs-specs.js index 6698f19ad..95cb065d5 100644 --- a/test/unit/processargs-specs.js +++ b/test/unit/processargs-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import XCUITestDriver from '../../lib/driver'; +import {XCUITestDriver} from '../../lib/driver'; describe('process args', function () { diff --git a/test/unit/real-device-management-specs.js b/test/unit/real-device-management-specs.js index de8173fda..a8579d4b0 100644 --- a/test/unit/real-device-management-specs.js +++ b/test/unit/real-device-management-specs.js @@ -1,7 +1,7 @@ import {createSandbox} from 'sinon'; import { installToRealDevice } from '../../lib/real-device-management'; -import RealDevice from '../../lib/real-device'; -import XCUITestDriver from '../../lib/driver'; +import {RealDevice} from '../../lib/real-device'; +import {XCUITestDriver} from '../../lib/driver'; describe('installToRealDevice', function () { diff --git a/test/unit/simulator-management-specs.js b/test/unit/simulator-management-specs.js index a2d3dd729..89e31b05f 100644 --- a/test/unit/simulator-management-specs.js +++ b/test/unit/simulator-management-specs.js @@ -1,5 +1,5 @@ import {runSimulatorReset} from '../../lib/simulator-management.js'; -import XCUITestDriver from '../../lib/driver'; +import {XCUITestDriver} from '../../lib/driver'; describe('simulator management', function () {