Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Jan 3, 2025
1 parent f0d9e81 commit 06e28b7
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 44 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

22 changes: 0 additions & 22 deletions .eslintrc.json

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,
];
4 changes: 2 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function getPids (pattern, opts = {}) {
.filter(Number)
.map((x) => `${x}`);
return multi ? result : (_.isEmpty(result) ? [] : result[0]);
} catch (err) {
} catch {
return [];
}
}
Expand Down Expand Up @@ -76,7 +76,7 @@ function fixOutputToArray (output) {
.reduce((acc, x) => {
try {
return [...acc, JSON.parse(x)];
} catch (e) {
} catch {
return acc;
}
}, []);
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/accessibility-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ accessibilityCommands.describePoint = async function describePoint (x, y) {
log.debug(`Describing the UI at (${x}, ${y}) on the device '${this.udid}'`);
try {
return JSON.parse(await this.exec(['ui', 'describe-point'], [x, y]));
} catch (ign) {
} catch {
return null;
}
};
Expand Down
8 changes: 4 additions & 4 deletions lib/tools/system-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ systemCallMethods.connect = async function connect (opts = {}) {
for (const binary of [IDB_EXECUTABLE, IDB_COMPANION_EXECUTABLE]) {
try {
binaryPaths[binary] = await fs.which(binary);
} catch (e) {
} catch {
throw new Error(`'${binary}' has not been found in PATH. ` +
`Is it installed? Read https://www.fbidb.io for more details`);
}
Expand All @@ -56,12 +56,12 @@ systemCallMethods.connect = async function connect (opts = {}) {
// idb connect command looks for a running idb_companion process that associates with specified udid.
// If not found, the command attempts to start the new idb_companion process that listens on an Unix domain socket.
await tpExec(IDB_EXECUTABLE, ['connect', this.udid]);
} catch (connectionError) {
} catch {
await retryInterval(2, 100, async () => {
await this.disconnect();
try {
await tpExec(IDB_EXECUTABLE, ['kill']);
} catch (ign) {}
} catch {}
await tpExec(IDB_EXECUTABLE, ['connect', this.udid]);
});
}
Expand Down Expand Up @@ -137,7 +137,7 @@ systemCallMethods.disconnect = async function disconnect () {
// idb disconnect just removes the given udid from idb state.
// It doesn't kill the idb_companion process associated with the udid.
await tpExec(this.executable.path, ['disconnect', this.udid]);
} catch (ign) {}
} catch {}

const companionPids = await getPids(COMPANION_PGREP_PATTERN(this.udid));
if (_.isEmpty(companionPids)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/video-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ videoCommands.stopVideoStream = async function stopVideoStream (process = null)
} else {
try {
await exec('pkill', [`-${KILL_SIGNAL}`, '-f', ['idb', 'video-stream', this.udid].join('.*')]);
} catch (ign) {}
} catch {}
}
};

Expand Down
2 changes: 1 addition & 1 deletion test/functional/accessibility-commands-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { retryInterval } from 'asyncbox';
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';

describe('idb accessibility commands', function () {
let idb;
Expand Down
4 changes: 2 additions & 2 deletions test/functional/app-commands-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';
import { waitForCondition } from 'asyncbox';

const MAPS_BUNDLE_ID = 'com.apple.Maps';
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('idb app commands', function () {
const terminateMapsApp = async () => {
try {
await idb.terminateApp(MAPS_BUNDLE_ID);
} catch (ign) {}
} catch {}
};
await terminateMapsApp();
const appProc = await idb.launchApp(MAPS_BUNDLE_ID, {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/crashlog-commands-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';

describe('idb crashlog commands', function () {
let idb;
Expand Down
8 changes: 4 additions & 4 deletions test/functional/idb-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';

async function assertDeviceDescription(idb, udid) {
const info = await idb.describeDevice();
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('idb general', function () {
await idb.disconnect();
try {
await simctl.shutdownDevice();
} catch (ign) {}
} catch {}
});

it('should be able to call connect/disconnect multiple times', async function () {
Expand All @@ -66,12 +66,12 @@ describe('idb general', function () {
beforeEach(async function () {
try {
await idb.connect();
} catch (e) {}
} catch {}
});
afterEach(async function () {
try {
await idb.disconnect();
} catch (e) {}
} catch {}
});

it('should be able to call connect multiple times', async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/interaction-commands-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';

describe('idb interaction commands', function () {
let simctl;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/misc-commands-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';

describe('idb misc commands', function () {
let simctl;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/xctest-commands-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import axios from 'axios';
import {
prepareDevice, deleteDevice, ONLINE_TIMEOUT_MS
} from '../helpers/device-helpers';
import IDB from '../../lib/idb';
import { IDB } from '../../lib/idb';
import { retryInterval } from 'asyncbox';

const WDA_BUNDLE_ID = 'com.facebook.WebDriverAgentRunner.xctrunner';
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/device-helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { util } from '@appium/support';
import { retryInterval } from 'asyncbox';
import Simctl from 'node-simctl';
import { Simctl } from 'node-simctl';

const MODEL = process.env.DEVICE_NAME || 'iPhone 8';
const PLATFORM_VERSION = process.env.PLATFORM_VERSION || '13.2';
Expand All @@ -26,7 +26,7 @@ async function deleteDevice (simctl) {
if (simctl?.udid) {
try {
await simctl.shutdownDevice();
} catch (ign) {}
} catch {}
await retryInterval(10, 1000, async () => await simctl.deleteDevice());
}
}
Expand Down

0 comments on commit 06e28b7

Please sign in to comment.