Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Jan 6, 2025
1 parent b134927 commit 22eb1ab
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 22 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import appiumConfig from '@appium/eslint-config-appium-ts';

export default [
...appiumConfig,
];
6 changes: 3 additions & 3 deletions lib/commands/record-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function uploadRecordedMedia (localFile, remotePath = null, uploadOptions
async function requireFfmpegPath () {
try {
return await fs.which(FFMPEG_BINARY);
} catch (e) {
} catch {
throw new Error(`${FFMPEG_BINARY} has not been found in PATH. ` +
`Please make sure it is installed`);
}
Expand Down Expand Up @@ -85,7 +85,7 @@ class ScreenRecorder {
this.log.debug('Force-stopping the currently running video recording');
try {
await this._process.stop('SIGKILL');
} catch (ign) {}
} catch {}
}
this._process = null;
const videoPath = await this.getVideoPath();
Expand Down Expand Up @@ -155,7 +155,7 @@ class ScreenRecorder {
waitMs: RETRY_TIMEOUT,
intervalMs: RETRY_PAUSE,
});
} catch (e) {
} catch {
await this._enforceTermination();
throw this.log.errorWithException(
`The expected screen record file '${this._videoPath}' does not exist. ` +
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/winapi/user32.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import nodeUtil from 'node:util';
let /** @type {import('koffi')|undefined} */ ffi;
try {
ffi = require('koffi');
} catch (ign) {}
} catch {}
let /** @type {import('koffi').struct|undefined} */ StructType;
try {
StructType = ffi?.struct;
} catch (ign) {}
} catch {}
let /** @type {any|undefined} */ UnionType;
try {
// @ts-ignore This is a typedef bug in koffi lib
UnionType = ffi?.union;
} catch (ign) {}
} catch {}

const NATIVE_LIBS_LOAD_ERROR = `Native Windows API calls cannot be invoked. ` +
`Please make sure you have the latest version of Visual Studio` +
Expand Down
2 changes: 1 addition & 1 deletion lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BaseDriver } from 'appium/driver';
import { system } from 'appium/support';
import { WinAppDriver } from './winappdriver';
import { desiredCapConstraints } from './desired-caps';
import commands from './commands/index';
import { commands } from './commands/index';
import { POWER_SHELL_FEATURE } from './constants';
import { newMethodMap } from './method-map';

Expand Down
4 changes: 2 additions & 2 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import { fs, tempDir } from 'appium/support';
import path from 'path';
import { exec } from 'teen_process';
import log from './logger';
import { log } from './logger';
import { queryRegistry } from './registry';
import { shellExec } from './utils';

Expand Down Expand Up @@ -97,7 +97,7 @@ export async function isAdmin () {
try {
await exec('fsutil.exe', ['dirty', 'query', process.env.SystemDrive || 'C:']);
return true;
} catch (ign) {
} catch {
return false;
}
};
2 changes: 1 addition & 1 deletion lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function queryRegistry (root) {
let stdout;
try {
({stdout} = await shellExec(REG, ['query', root, '/s']));
} catch (e) {
} catch {
return [];
}
return parseRegQueryOutput(stdout);
Expand Down
4 changes: 2 additions & 2 deletions lib/winappdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class WADProcess {
const [startPort, endPort] = WAD_PORT_RANGE;
try {
this.port = await findAPortNotInUse(startPort, endPort);
} catch (e) {
} catch {
throw this.log.errorWithException(
`Could not find any free port in range ${startPort}..${endPort}. ` +
`Please check your system firewall settings or set 'systemPort' capability ` +
Expand Down Expand Up @@ -120,7 +120,7 @@ process.once('exit', () => {
const command = 'taskkill.exe ' + RUNNING_PROCESS_IDS.map((pid) => `/PID ${pid}`).join(' ');
try {
execSync(command);
} catch (ign) {}
} catch {}
});

class WinAppDriver {
Expand Down
4 changes: 2 additions & 2 deletions scripts/install-wad.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from 'axios';
import semver from 'semver';
import * as semver from 'semver';
import _ from 'lodash';
import path from 'node:path';
import { tmpdir } from 'node:os';
Expand Down Expand Up @@ -170,7 +170,7 @@ async function installWad(version) {
} finally {
try {
await fs.unlink(installerPath);
} catch (ign) {}
} catch {}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/commands/file-movement-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('file movement', function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

should = chai.should();
chai.should();
chai.use(chaiAsPromised.default);
});

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/commands/winapi-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commands } from '../../../lib/commands/gestures';
import log from '../../../lib/logger';
import { log } from '../../../lib/logger';


describe('winapi', function () {
Expand All @@ -9,7 +9,7 @@ describe('winapi', function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

should = chai.should();
chai.should();
chai.use(chaiAsPromised.default);
commands.log = log;
});
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/driver-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Driver', function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

should = chai.should();
chai.should();
chai.use(chaiAsPromised.default);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit/driver-specs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// transpile:mocha

import WindowsDriver from '../../lib/driver';
import { WindowsDriver } from '../../lib/driver';
import sinon from 'sinon';
import B from 'bluebird';
import { system } from 'appium/support';
Expand All @@ -14,7 +14,7 @@ describe('driver.js', function () {
chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');

should = chai.should();
chai.should();
chai.use(chaiAsPromised.default);

isWindowsStub = sinon.stub(system, 'isWindows').returns(true);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/registry-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('registry', function () {
before(async function () {
chai = await import('chai');

should = chai.should();
chai.should();
});

it('should parse reg query output', function () {
Expand Down

0 comments on commit 22eb1ab

Please sign in to comment.