Skip to content

Commit 6c85043

Browse files
catenate strings
1 parent 2d9f2dd commit 6c85043

12 files changed

Lines changed: 31 additions & 46 deletions

lib/tools/aab-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function extractUniversalApk(this: ADB, aabPath: string, opts: ApkC
6161
let cacheHash = aabHash;
6262
if (keystore) {
6363
if (!(await fs.exists(keystore))) {
64-
throw new Error(`The keystore file at '${keystore}' either does not exist ` + `or is not accessible`);
64+
throw new Error(`The keystore file at '${keystore}' either does not exist or is not accessible`);
6565
}
6666
if (!keystorePassword || !keyAlias || !keyPassword) {
6767
throw new Error(

lib/tools/android-manifest.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export async function targetSdkVersionFromManifest(this: ADB, appPath: string):
4747

4848
const {targetSdkVersion} = await readPackageManifest.bind(this)(appPath);
4949
if (!targetSdkVersion) {
50-
throw new Error(
51-
`Cannot extract targetSdkVersion of '${originalAppPath}'. Does ` + `the package manifest define it?`,
52-
);
50+
throw new Error(`Cannot extract targetSdkVersion of '${originalAppPath}'. Does the package manifest define it?`);
5351
}
5452
return targetSdkVersion;
5553
}

lib/tools/apk-signing.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,9 @@ export async function signWithCustomCert(this: ADB, apk: string): Promise<void>
156156
await exec(fullCmd[0], fullCmd.slice(1));
157157
} catch (e) {
158158
const execErr = e as ExecError;
159-
throw new Error(
160-
`Could not sign with custom certificate. ` + `Original error: ${execErr.stderr || execErr.message}`,
161-
{cause: e},
162-
);
159+
throw new Error(`Could not sign with custom certificate. Original error: ${execErr.stderr || execErr.message}`, {
160+
cause: e,
161+
});
163162
}
164163
}
165164
}
@@ -289,9 +288,9 @@ export async function checkApkCert(this: ADB, appPath: string, opts: CertCheckOp
289288
const output = await this.executeApksigner(['verify', '--print-certs', actualAppPath]);
290289
const hasMatch = hashMatches(output, expected);
291290
if (hasMatch) {
292-
log.info(`'${actualAppPath}' is signed with the ` + `${this.useKeystore ? 'keystore' : 'default'} certificate`);
291+
log.info(`'${actualAppPath}' is signed with the ${this.useKeystore ? 'keystore' : 'default'} certificate`);
293292
} else {
294-
log.info(`'${actualAppPath}' is signed with a ` + `non-${this.useKeystore ? 'keystore' : 'default'} certificate`);
293+
log.info(`'${actualAppPath}' is signed with a non-${this.useKeystore ? 'keystore' : 'default'} certificate`);
295294
}
296295
const isSigned = (!this.useKeystore && !requireDefaultCert) || hasMatch;
297296
if (isSigned) {
@@ -323,7 +322,7 @@ export async function checkApkCert(this: ADB, appPath: string, opts: CertCheckOp
323322
log.warn(`Assuming '${actualAppPath}' is already signed and continuing anyway`);
324323
return true;
325324
}
326-
throw new Error(`Cannot verify the signature of '${actualAppPath}'. ` + `Original error: ${errMsg}`, {cause: err});
325+
throw new Error(`Cannot verify the signature of '${actualAppPath}'. Original error: ${errMsg}`, {cause: err});
327326
}
328327
}
329328

@@ -371,7 +370,7 @@ export async function getKeystoreHash(this: ADB): Promise<KeystoreHash> {
371370
} catch (e) {
372371
const err = e as ExecError;
373372
throw new Error(
374-
`Cannot get the hash of '${this.keystorePath}' keystore. ` + `Original error: ${err.stderr || err.message}`,
373+
`Cannot get the hash of '${this.keystorePath}' keystore. Original error: ${err.stderr || err.message}`,
375374
{cause: e},
376375
);
377376
}

lib/tools/apk-utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export async function cacheApk(this: ADB, apkPath: string, options: CachingOptio
109109
}
110110
if (typeof lsOutput !== 'string' || (lsOutput.includes(errorMarker) && !lsOutput.includes(REMOTE_CACHE_ROOT))) {
111111
if (typeof this._areExtendedLsOptionsSupported !== 'boolean') {
112-
log.debug('The current Android API does not support extended ls options. ' + 'Defaulting to no-options call');
112+
log.debug('The current Android API does not support extended ls options. Defaulting to no-options call');
113113
}
114114
lsOutput = await this.shell([`ls ${REMOTE_CACHE_ROOT} 2>&1 || echo ${errorMarker}`]);
115115
this._areExtendedLsOptionsSupported = false;
@@ -349,7 +349,7 @@ export async function installOrUpgrade(
349349
if ('name' in apkInfo) {
350350
pkg = apkInfo.name;
351351
} else {
352-
log.warn(`Cannot determine the package name of '${appPath}'. ` + `Continuing with the install anyway`);
352+
log.warn(`Cannot determine the package name of '${appPath}'. Continuing with the install anyway`);
353353
}
354354
}
355355

@@ -457,7 +457,7 @@ export async function extractStringsFromApk(
457457
apkStrings = parseAaptStrings(stdout, configMarker);
458458
} catch (e) {
459459
const err = e as ExecError;
460-
log.debug('Cannot extract resources using aapt. Trying aapt2. ' + `Original error: ${err.stderr || err.message}`);
460+
log.debug(`Cannot extract resources using aapt. Trying aapt2. Original error: ${err.stderr || err.message}`);
461461

462462
await this.initAapt2();
463463

@@ -475,7 +475,7 @@ export async function extractStringsFromApk(
475475
apkStrings = parseAapt2Strings(stdout, configMarker);
476476
} catch (e) {
477477
const error = e as Error;
478-
throw new Error(`Cannot extract resources from '${originalAppPath}'. ` + `Original error: ${error.message}`, {
478+
throw new Error(`Cannot extract resources from '${originalAppPath}'. Original error: ${error.message}`, {
479479
cause: e,
480480
});
481481
}
@@ -748,7 +748,7 @@ async function formatConfigMarker(
748748
log.debug(`Resource configurations: ${JSON.stringify(configs)}`);
749749
// Assume the 'en' configuration is the default one
750750
if (configMarker.toLowerCase().startsWith('en') && !configs.some((x) => x.trim() === configMarker)) {
751-
log.debug(`Resource configuration name '${configMarker}' is unknown. ` + `Replacing it with '${defaultMarker}'`);
751+
log.debug(`Resource configuration name '${configMarker}' is unknown. Replacing it with '${defaultMarker}'`);
752752
configMarker = defaultMarker;
753753
} else {
754754
log.debug(`Selected configuration: '${configMarker}'`);

lib/tools/app-commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ export async function startApp(this: ADB, startAppOptions: StartAppOptions): Pro
616616
if (stdout.includes('Error: Activity class') && stdout.includes('does not exist')) {
617617
if (options.retry && options.activity && !options.activity.startsWith('.')) {
618618
log.debug(
619-
`We tried to start an activity that doesn't exist, ` + `retrying with '.${options.activity}' activity name`,
619+
`We tried to start an activity that doesn't exist, retrying with '.${options.activity}' activity name`,
620620
);
621621
options.activity = `.${options.activity}`;
622622
options.retry = false;

lib/tools/device-settings.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export async function getPlatformVersion(this: ADB): Promise<string> {
238238
return await this.getDeviceProperty('ro.build.version.release');
239239
} catch (e) {
240240
const err = e as Error;
241-
throw new Error(`Error getting device platform version. ` + `Original error: ${err.message}`, {
241+
throw new Error(`Error getting device platform version. Original error: ${err.message}`, {
242242
cause: e,
243243
});
244244
}
@@ -312,9 +312,7 @@ export async function setHiddenApiPolicy(this: ADB, value: number | string, igno
312312
if (!ignoreError) {
313313
throw decorateWriteSecureSettingsException(err);
314314
}
315-
log.info(
316-
`Failed to set setting keys '${HIDDEN_API_POLICY_KEYS}' to '${value}'. ` + `Original error: ${err.message}`,
317-
);
315+
log.info(`Failed to set setting keys '${HIDDEN_API_POLICY_KEYS}' to '${value}'. Original error: ${err.message}`);
318316
}
319317
}
320318

lib/tools/emulator-commands.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export async function rotate(this: ADB): Promise<void> {
7474
export async function powerAC(this: ADB, state: PowerAcStates = 'on'): Promise<void> {
7575
if (!(Object.values(this.POWER_AC_STATES) as string[]).includes(state)) {
7676
throw new TypeError(
77-
`Wrong power AC state sent '${state}'. ` + `Supported values: ${Object.values(this.POWER_AC_STATES)}]`,
77+
`Wrong power AC state sent '${state}'. Supported values: ${Object.values(this.POWER_AC_STATES)}]`,
7878
);
7979
}
8080
await this.adbExecEmu(['power', 'ac', state]);
@@ -89,7 +89,7 @@ export async function powerAC(this: ADB, state: PowerAcStates = 'on'): Promise<v
8989
*/
9090
export async function sensorSet(this: ADB, sensor: string, value: Sensors): Promise<void> {
9191
if (!(Object.values(this.SENSORS) as string[]).includes(sensor)) {
92-
throw new TypeError(`Unsupported sensor sent '${sensor}'. ` + `Supported values: ${Object.values(this.SENSORS)}]`);
92+
throw new TypeError(`Unsupported sensor sent '${sensor}'. Supported values: ${Object.values(this.SENSORS)}]`);
9393
}
9494
if (value == null) {
9595
throw new TypeError(
@@ -248,7 +248,7 @@ export async function execEmuConsoleCommand(
248248

249249
return await new Promise<string>((resolve, reject) => {
250250
const connTimeoutObj = setTimeout(
251-
() => reject(new Error(`Cannot connect to the Emulator console at ${host}:${port} ` + `after ${connTimeout}ms`)),
251+
() => reject(new Error(`Cannot connect to the Emulator console at ${host}:${port} after ${connTimeout}ms`)),
252252
connTimeout,
253253
);
254254
let execTimeoutObj: NodeJS.Timeout;
@@ -258,7 +258,7 @@ export async function execEmuConsoleCommand(
258258

259259
client.once('error', (e) => {
260260
clearTimeout(connTimeoutObj);
261-
reject(new Error(`Cannot connect to the Emulator console at ${host}:${port}. ` + `Original error: ${e.message}`));
261+
reject(new Error(`Cannot connect to the Emulator console at ${host}:${port}. Original error: ${e.message}`));
262262
});
263263

264264
client.once('connect', () => {

lib/tools/general-commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export async function takeScreenshot(this: ADB, displayId?: number | string): Pr
323323
outputStr = typeof stdout === 'string' ? stdout : stdout.toString('utf-8');
324324
}
325325
throw new Error(
326-
`Screenshot of the ${displayDescr} failed. ` + `Code: '${err.code ?? 'unknown'}', output: '${outputStr}'`,
326+
`Screenshot of the ${displayDescr} failed. Code: '${err.code ?? 'unknown'}', output: '${outputStr}'`,
327327
{cause: e},
328328
);
329329
}

lib/tools/lockmgmt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function isLockManagementSupported(this: ADB): Promise<boolean> {
2525
output = await this.shell([`locksettings help && echo ${passFlag}`]);
2626
} catch {}
2727
this._isLockManagementSupported = output.includes(passFlag);
28-
log.debug(`Extended lock settings management is ` + `${this._isLockManagementSupported ? '' : 'not '}supported`);
28+
log.debug(`Extended lock settings management is ${this._isLockManagementSupported ? '' : 'not '}supported`);
2929
}
3030
return this._isLockManagementSupported as boolean;
3131
}

lib/tools/system-calls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ export async function killEmulator(
899899
export async function launchAVD(this: ADB, avdName: string, opts: AvdLaunchOptions = {}): Promise<SubProcess> {
900900
const {args = [], env = {}, language, country, launchTimeout = 60000, readyTimeout = 60000, retryTimes = 1} = opts;
901901
log.debug(
902-
`Launching Emulator with AVD ${avdName}, launchTimeout ` + `${launchTimeout}ms and readyTimeout ${readyTimeout}ms`,
902+
`Launching Emulator with AVD ${avdName}, launchTimeout ${launchTimeout}ms and readyTimeout ${readyTimeout}ms`,
903903
);
904904
const emulatorBinaryPath = await this.getSdkBinaryPath('emulator');
905905
let processedAvdName = avdName;

0 commit comments

Comments
 (0)