diff --git a/src/__tests__/fixture/db.ts b/src/__tests__/fixture/db.ts index 186a2de8..3492d897 100644 --- a/src/__tests__/fixture/db.ts +++ b/src/__tests__/fixture/db.ts @@ -37,9 +37,13 @@ export async function purgeContainer(container: Docker.Container) { await containers.delete(container); try { await container.remove({ force: true }); - } catch (err: { statusCode?: number }) { + } catch (err: any) { + const statusCode = + err && err.statusCode && typeof err.statusCode === "number" + ? err.statusCode + : 0; // if 404, we probably used the --rm flag on container launch. it's all good. - if (!(err.statusCode === 404 || err.statusCode === 409)) { + if (!(statusCode === 404 || statusCode === 409)) { throw err; // eslint-disable-line } }