mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-21 06:33:30 +00:00
Update to typescript 4.8.2
Change-type: patch
This commit is contained in:
parent
4153c179b8
commit
a4c13aa2e9
6
package-lock.json
generated
6
package-lock.json
generated
@ -11848,9 +11848,9 @@
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
|
||||
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
|
||||
"version": "4.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
|
@ -129,7 +129,7 @@
|
||||
"ts-node": "^8.10.2",
|
||||
"tsconfig-paths": "^4.1.0",
|
||||
"typed-error": "^3.2.1",
|
||||
"typescript": "^4.2.4",
|
||||
"typescript": "^4.8.3",
|
||||
"webpack": "^4.44.1",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"winston": "^3.3.3",
|
||||
|
@ -535,7 +535,7 @@ async function reportInitialName(
|
||||
device_name: name,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
log.error('Unable to report initial device name to API');
|
||||
logger.logSystemMessage(
|
||||
'Unable to report initial device name to API',
|
||||
|
@ -809,7 +809,7 @@ export class App {
|
||||
let imageInfo: ImageInspectInfo | undefined;
|
||||
try {
|
||||
imageInfo = await imageManager.inspectByName(svc.image);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
throw e;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ export async function triggerFetch(
|
||||
await markAsSupervised({ ...image, dockerImageId: img.Id });
|
||||
|
||||
success = true;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
if (!(e instanceof ImageDownloadBackoffError)) {
|
||||
addImageFailure(image.name);
|
||||
@ -618,7 +618,7 @@ export async function cleanup() {
|
||||
try {
|
||||
await docker.getImage(image).remove({ force: true });
|
||||
delete imageCleanupFailures[image];
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
logger.logSystemMessage(
|
||||
`Error cleaning up ${image}: ${e.message} - will ignore for 1 hour`,
|
||||
{ error: e },
|
||||
@ -730,7 +730,7 @@ async function removeImageIfNotNeeded(image: Image): Promise<void> {
|
||||
|
||||
// Mark the image as removed
|
||||
removed = true;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (NotFoundError(e)) {
|
||||
removed = false;
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ export async function create(network: Network) {
|
||||
|
||||
// We have a network with the same config and name
|
||||
// already created, we can skip this
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
logger.logSystemEvent(logTypes.createNetworkError, {
|
||||
network: { name: network.name, appUuid: network.appUuid },
|
||||
|
@ -74,7 +74,7 @@ export const getAll = async (
|
||||
service.status = vState.status;
|
||||
}
|
||||
return service;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (NotFoundError(e)) {
|
||||
return null;
|
||||
}
|
||||
@ -210,7 +210,7 @@ export async function remove(service: Service) {
|
||||
|
||||
try {
|
||||
await docker.getContainer(existingService.containerId).remove({ v: true });
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
logger.logSystemEvent(LogTypes.removeDeadServiceError, {
|
||||
service,
|
||||
@ -231,7 +231,7 @@ async function create(service: Service) {
|
||||
);
|
||||
}
|
||||
return docker.getContainer(existing.containerId);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
logger.logSystemEvent(LogTypes.installServiceError, {
|
||||
service,
|
||||
@ -387,7 +387,7 @@ export function listenToEvents() {
|
||||
let service: Service | null = null;
|
||||
try {
|
||||
service = await getByDockerContainerId(data.id);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
throw e;
|
||||
}
|
||||
@ -418,7 +418,7 @@ export function listenToEvents() {
|
||||
await logMonitor.detach(data.id);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
log.error('Error on docker event:', e, e.stack);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export async function create(volume: Volume): Promise<void> {
|
||||
if (!volume.isEqualConfig(existing)) {
|
||||
throw new ResourceRecreationAttemptError('volume', volume.name);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!NotFoundError(e)) {
|
||||
logger.logSystemEvent(LogTypes.createVolumeError, {
|
||||
volume: { name: volume.name },
|
||||
|
@ -186,7 +186,7 @@ export class Odmdata extends ConfigBackend {
|
||||
): Promise<fs.FileHandle> {
|
||||
try {
|
||||
return await fs.open(file, flags);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
switch (e.code) {
|
||||
case 'ENOENT':
|
||||
log.error(`File not found at: ${file}`);
|
||||
|
@ -332,11 +332,11 @@ function valueToString(value: unknown, name: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkValueDecode(
|
||||
decoded: Either<t.Errors, unknown>,
|
||||
function checkValueDecode<T>(
|
||||
decoded: Either<t.Errors, T>,
|
||||
key: string,
|
||||
value: unknown,
|
||||
): decoded is Right<unknown> {
|
||||
value: T,
|
||||
): decoded is Right<T> {
|
||||
if (isLeft(decoded)) {
|
||||
throw new ConfigurationValidationError(key, value);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ export function createV2Api(router: Router) {
|
||||
let apps: any;
|
||||
try {
|
||||
apps = await applicationManager.getLegacyState();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
log.error(e.message);
|
||||
return res.status(500).json({
|
||||
status: 'failed',
|
||||
@ -358,7 +358,7 @@ export function createV2Api(router: Router) {
|
||||
status: 'success',
|
||||
message: 'OK',
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
res.status(400).json({
|
||||
status: 'failed',
|
||||
message: e.message,
|
||||
@ -380,7 +380,7 @@ export function createV2Api(router: Router) {
|
||||
deviceType,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
res.status(500).json({
|
||||
status: 'failed',
|
||||
message: e.message,
|
||||
@ -536,7 +536,7 @@ export function createV2Api(router: Router) {
|
||||
status: 'success',
|
||||
tags,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
log.error(e);
|
||||
res.status(500).json({
|
||||
status: 'failed',
|
||||
|
@ -79,7 +79,7 @@ const actionExecutors: DeviceActionExecutors = {
|
||||
success: true,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
if (step.humanReadableTarget) {
|
||||
logger.logConfigChange(step.humanReadableTarget, {
|
||||
err,
|
||||
@ -102,7 +102,7 @@ const actionExecutors: DeviceActionExecutors = {
|
||||
if (!initial) {
|
||||
logger.logConfigChange(logValue, { success: true });
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
logger.logConfigChange(logValue, { err });
|
||||
throw err;
|
||||
}
|
||||
@ -271,7 +271,7 @@ export async function getTarget({
|
||||
let conf: Dictionary<string>;
|
||||
try {
|
||||
conf = JSON.parse(devConfig.targetValues);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
throw new Error(`Corrupted supervisor database! Error: ${e.message}`);
|
||||
}
|
||||
if (initial || conf.SUPERVISOR_VPN_CONTROL == null) {
|
||||
@ -697,7 +697,7 @@ async function isVPNEnabled(): Promise<boolean> {
|
||||
try {
|
||||
const activeState = await dbus.serviceActiveState(vpnServiceName);
|
||||
return !_.includes(['inactive', 'deactivating'], activeState);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (UnitNotLoadedError(e)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function createDeviceStateRouter() {
|
||||
try {
|
||||
const response = await executeStepAction({ action }, { force });
|
||||
res.status(202).json(response);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
const status = e instanceof UpdatesLockedError ? 423 : 500;
|
||||
res.status(status).json({
|
||||
Data: '',
|
||||
@ -155,7 +155,7 @@ function createDeviceStateRouter() {
|
||||
validation.checkTruthy(req.body.force) || lockOverride,
|
||||
);
|
||||
res.status(200).send('OK');
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// TODO: We should be able to throw err if it's UpdatesLockedError
|
||||
// and the error middleware will handle it, but this doesn't work in
|
||||
// the test environment. Fix this when fixing API tests.
|
||||
@ -194,7 +194,7 @@ function createDeviceStateRouter() {
|
||||
stateToSend.download_progress = service.download_progress;
|
||||
}
|
||||
res.json(stateToSend);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
res.status(500).json({
|
||||
Data: '',
|
||||
Error: (e != null ? e.message : undefined) || e || 'Unknown error',
|
||||
@ -772,7 +772,7 @@ export async function applyStep<T extends PossibleStepTargets>(
|
||||
skipLock,
|
||||
});
|
||||
emitAsync('step-completed', null, step, stepResult || undefined);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
emitAsync('step-error', e, step);
|
||||
throw e;
|
||||
}
|
||||
@ -918,7 +918,7 @@ export const applyTarget = async ({
|
||||
nextDelay,
|
||||
retryCount,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e instanceof UpdatesLockedError) {
|
||||
// Forward the UpdatesLockedError directly
|
||||
throw e;
|
||||
|
@ -57,7 +57,7 @@ export async function loadTargetFromFile(appsPath: string): Promise<boolean> {
|
||||
let stateFromFile: AppsJsonFormat | any[];
|
||||
try {
|
||||
stateFromFile = JSON.parse(content);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
throw new AppsJsonParseError(e);
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ export async function loadTargetFromFile(appsPath: string): Promise<boolean> {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
// Ensure that this is actually a file, and not an empty path
|
||||
// It can be an empty path because if the file does not exist
|
||||
// on host, the docker daemon creates an empty directory when
|
||||
|
@ -188,7 +188,7 @@ const poll = async (
|
||||
await update();
|
||||
// Reset fetchErrors because we successfuly updated
|
||||
fetchErrors = 0;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Exponential back off if request fails
|
||||
pollInterval = Math.min(appUpdatePollInterval, 15000 * 2 ** fetchErrors);
|
||||
++fetchErrors;
|
||||
|
@ -67,7 +67,7 @@ async function readProxy(): Promise<ProxyConfig | undefined> {
|
||||
let redsocksConf: string;
|
||||
try {
|
||||
redsocksConf = await fs.readFile(redsocksConfPath, 'utf-8');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!ENOENT(e)) {
|
||||
throw e;
|
||||
}
|
||||
@ -99,7 +99,7 @@ async function readProxy(): Promise<ProxyConfig | undefined> {
|
||||
if (noProxy.length) {
|
||||
conf.noProxy = noProxy;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (!ENOENT(e)) {
|
||||
throw e;
|
||||
}
|
||||
@ -141,7 +141,7 @@ async function setProxy(maybeConf: ProxyConfig | null): Promise<void> {
|
||||
let currentConf: ProxyConfig | undefined;
|
||||
try {
|
||||
currentConf = await readProxy();
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// Noop - current redsocks.conf does not exist
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ export const fetchDevice = async (
|
||||
}
|
||||
|
||||
return device;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
throw new DeviceNotFoundError();
|
||||
}
|
||||
};
|
||||
@ -123,7 +123,7 @@ export const exchangeKeyAndGetDevice = async (
|
||||
opts.provisioningApiKey,
|
||||
apiTimeout,
|
||||
);
|
||||
} catch (err) {
|
||||
} catch {
|
||||
throw new ExchangeKeyError(`Couldn't fetch device with provisioning key`);
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ export function validateTargetContracts(
|
||||
service.labels?.['io.balena.features.optional'],
|
||||
),
|
||||
};
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
throw new ContractValidationError(serviceName, e.message);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export function equals<T>(value: T, other: T): boolean {
|
||||
* Returns true if the the object equals `{}` or is an empty
|
||||
* array
|
||||
*/
|
||||
export function empty<T>(value: T): boolean {
|
||||
export function empty<T extends {}>(value: T): boolean {
|
||||
return (Array.isArray(value) && value.length === 0) || equals(value, {});
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ async function createVolumeFromLegacyData(
|
||||
{},
|
||||
legacyPath,
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
logger.logSystemMessage(
|
||||
`Warning: could not migrate legacy /data volume: ${e.message}`,
|
||||
{ error: e },
|
||||
@ -85,7 +85,7 @@ export async function normaliseLegacyDatabase() {
|
||||
|
||||
try {
|
||||
services = JSON.parse(app.services);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
throw new DatabaseParseError(e);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ export async function unlock(path: string): Promise<void> {
|
||||
export function unlockSync(path: string) {
|
||||
try {
|
||||
return unlinkSync(path);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.code === 'EPERM' || e.code === 'EISDIR') {
|
||||
return rmdirSync(path);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ const getOSReleaseData = _.memoize(
|
||||
const value = _.trim(values.join('=')).replace(/^"(.+(?="$))"$/, '$1');
|
||||
releaseItems[_.trim(key)] = value;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
throw new InternalInconsistencyError(
|
||||
`Unable to read file at ${path}: ${e.message} ${e.stack}`,
|
||||
);
|
||||
|
@ -112,7 +112,7 @@ export async function lock<T extends unknown>(
|
||||
let lockOverride: boolean;
|
||||
try {
|
||||
lockOverride = await config.get('lockOverride');
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new InternalInconsistencyError(
|
||||
`Error getting lockOverride config value: ${err?.message ?? err}`,
|
||||
);
|
||||
|
@ -161,7 +161,7 @@ export class LocalModeManager {
|
||||
return this.collectContainerResources(
|
||||
this.containerId || SUPERVISOR_CONTAINER_NAME_FALLBACK,
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (this.containerId !== undefined) {
|
||||
try {
|
||||
// Inspect operation fails (container ID is out of sync?).
|
||||
@ -172,7 +172,7 @@ export class LocalModeManager {
|
||||
e.message,
|
||||
);
|
||||
return this.collectContainerResources(fallback);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
// Inspect operation fails (using legacy container name?).
|
||||
const fallback = SUPERVISOR_LEGACY_CONTAINER_NAME_FALLBACK;
|
||||
log.warn(
|
||||
@ -230,7 +230,7 @@ export class LocalModeManager {
|
||||
EngineSnapshot.fromJSON(r.snapshot),
|
||||
LocalModeManager.parseTimestamp(r.timestamp),
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
// Some parsing error happened. Ensure we add data details to the error description.
|
||||
throw new Error(
|
||||
`Cannot parse snapshot data ${JSON.stringify(r)}.` +
|
||||
|
@ -4,7 +4,7 @@ const _ = require('lodash');
|
||||
var tryParse = function (obj) {
|
||||
try {
|
||||
return JSON.parse(obj);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ exports.up = function (knex) {
|
||||
try {
|
||||
const parsed = JSON.parse(data.toString());
|
||||
resolve(parsed);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
console.log(
|
||||
'Failed to parse config.json! Things may fail unexpectedly!',
|
||||
);
|
||||
|
@ -25,7 +25,7 @@ exports.up = function (knex) {
|
||||
return resolve(checkTruthy(parsed.localMode));
|
||||
}
|
||||
return resolve(false);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
console.log(
|
||||
'Failed to parse config.json! Things may fail unexpectedly!',
|
||||
);
|
||||
|
@ -46,7 +46,7 @@ export async function isVPNActive(): Promise<boolean> {
|
||||
let active: boolean = true;
|
||||
try {
|
||||
await fs.lstat(`${constants.vpnStatusPath}/active`);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
active = false;
|
||||
}
|
||||
log.info(`VPN connection is ${active ? 'active' : 'not active'}.`);
|
||||
|
@ -96,7 +96,7 @@ const createProxyvisorRouter = function (proxyvisor) {
|
||||
const fields = await db.models('dependentDevice').select();
|
||||
const devices = fields.map(parseDeviceFields);
|
||||
res.json(devices);
|
||||
} catch (err) {
|
||||
} catch (/** @type {any} */ err) {
|
||||
res.status(503).send(err?.message || err || 'Unknown error');
|
||||
}
|
||||
});
|
||||
@ -320,7 +320,7 @@ const createProxyvisorRouter = function (proxyvisor) {
|
||||
);
|
||||
}
|
||||
res.sendFile(dest);
|
||||
} catch (err) {
|
||||
} catch (/** @type {any} */ err) {
|
||||
log.error(`Error on ${req.method} ${url.parse(req.url).pathname}`, err);
|
||||
return res.status(503).send(err?.message || err || 'Unknown error');
|
||||
}
|
||||
@ -337,7 +337,7 @@ const createProxyvisorRouter = function (proxyvisor) {
|
||||
config: JSON.parse(app.config ?? '{}'),
|
||||
}));
|
||||
res.json($apps);
|
||||
} catch (err) {
|
||||
} catch (/** @type {any} */ err) {
|
||||
log.error(`Error on ${req.method} ${url.parse(req.url).pathname}`, err);
|
||||
return res.status(503).send(err?.message || err || 'Unknown error');
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export class SupervisorAPI {
|
||||
return res.status(500).send('Unhealthy');
|
||||
}
|
||||
return res.sendStatus(200);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
log.error('Healthcheck failed');
|
||||
return res.status(500).send('Unhealthy');
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ export async function initDevice(opts: Opts) {
|
||||
opts.docker,
|
||||
true,
|
||||
);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
await Bluebird.delay(500);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ describe('device-state', () => {
|
||||
|
||||
try {
|
||||
await testDb.destroy();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* noop */
|
||||
}
|
||||
sinon.restore();
|
||||
|
@ -39,7 +39,7 @@ describe('SupervisorAPI', () => {
|
||||
after(async () => {
|
||||
try {
|
||||
await api.stop();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.message !== 'Server is not running.') {
|
||||
throw e;
|
||||
}
|
||||
@ -170,7 +170,7 @@ describe('SupervisorAPI', () => {
|
||||
// Start each case with API stopped
|
||||
try {
|
||||
await api.stop();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.message !== 'Server is not running.') {
|
||||
throw e;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ describe('LocalModeManager', () => {
|
||||
try {
|
||||
const result = await localMode.retrieveLatestSnapshot();
|
||||
expect(result).to.not.exist;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
expect(e.message).to.match(/Cannot parse snapshot data.*"bad json"/);
|
||||
}
|
||||
});
|
||||
@ -416,7 +416,7 @@ describe('LocalModeManager', () => {
|
||||
try {
|
||||
const result = await localMode.retrieveLatestSnapshot();
|
||||
expect(result).to.not.exist;
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
expect(e.message).to.match(
|
||||
/Cannot parse snapshot data.*"bad timestamp"/,
|
||||
);
|
||||
|
@ -147,7 +147,7 @@ describe('Extlinux Configuration', () => {
|
||||
// Expect correct rejection from the given bad config
|
||||
try {
|
||||
await backend.getBootConfig();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
expect(e.message).to.equal(badConfig.reason);
|
||||
}
|
||||
// Restore stub
|
||||
|
@ -43,7 +43,7 @@ describe('db-format', () => {
|
||||
after(async () => {
|
||||
try {
|
||||
await testDb.destroy();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* noop */
|
||||
}
|
||||
sinon.restore();
|
||||
|
@ -62,7 +62,7 @@ describe('ODMDATA Configuration', () => {
|
||||
try {
|
||||
// @ts-ignore accessing private value
|
||||
await backend.getFileHandle(testConfigPath);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
// Check that correct message was logged
|
||||
@ -104,7 +104,7 @@ describe('ODMDATA Configuration', () => {
|
||||
try {
|
||||
// @ts-ignore accessing private value
|
||||
backend.parseOptions(Buffer.from([0x1, 0x0, 0x0]));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
// Check that correct message was logged
|
||||
|
@ -118,7 +118,7 @@ describe('SupervisorAPI [V1 Endpoints]', () => {
|
||||
after(async () => {
|
||||
try {
|
||||
await api.stop();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.message !== 'Server is not running.') {
|
||||
throw e;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ describe('SupervisorAPI [V2 Endpoints]', () => {
|
||||
after(async () => {
|
||||
try {
|
||||
await api.stop();
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
if (e.message !== 'Server is not running.') {
|
||||
throw e;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ describe('compose/application-manager', () => {
|
||||
after(async () => {
|
||||
try {
|
||||
await testDb.destroy();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* noop */
|
||||
}
|
||||
// Restore stubbed methods
|
||||
|
@ -207,7 +207,7 @@ function createMockedDockerode(data: TestData) {
|
||||
return mockedDockerode;
|
||||
}
|
||||
|
||||
type Prototype = Dictionary<(...args: any[]) => any>;
|
||||
type Prototype = { [key: string]: any };
|
||||
function clonePrototype(prototype: Prototype): Prototype {
|
||||
const clone: Prototype = {};
|
||||
Object.getOwnPropertyNames(prototype).forEach((fn) => {
|
||||
|
@ -47,7 +47,9 @@ function createFake<Prototype extends object>(prototype: Prototype) {
|
||||
...res,
|
||||
[fn]: () => {
|
||||
throw Error(
|
||||
`Fake method not implemented: ${prototype.constructor.name}.${fn}()`,
|
||||
`Fake method not implemented: ${
|
||||
prototype.constructor.name
|
||||
}.${fn.toString()}()`,
|
||||
);
|
||||
},
|
||||
}),
|
||||
|
@ -24,13 +24,13 @@ export = async function () {
|
||||
|
||||
try {
|
||||
fs.unlinkSync(process.env.DATABASE_PATH_2!);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* ignore /*/
|
||||
}
|
||||
|
||||
try {
|
||||
fs.unlinkSync(process.env.DATABASE_PATH_3!);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* ignore /*/
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ export = async function () {
|
||||
'./test/data/config-apibinder-offline2.json',
|
||||
fs.readFileSync('./test/data/testconfig-apibinder-offline2.json'),
|
||||
);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
/* ignore /*/
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ const lookForOptionalDeps = function (sourceDir) {
|
||||
packageJson = JSON.parse(
|
||||
fs.readFileSync(path.join(sourceDir, dir, '/package.json'), 'utf8'),
|
||||
);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (packageJson.optionalDependencies != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user