From 42ad99e20b391d213dfd93a775753877345f5e79 Mon Sep 17 00:00:00 2001 From: Yannick Bungers Date: Sun, 30 Jan 2022 22:00:17 +0100 Subject: [PATCH] Replace fs.rmdir recursive by fs.rm recursive fs.rmdir(path, { recursive: true}) is deprecated and is replaced by fs.rm(path, { recursive: true}). Signed-off-by: Yannick Bungers --- test/private-api/notes.e2e-spec.ts | 2 +- test/public-api/me.e2e-spec.ts | 4 ++-- test/public-api/notes.e2e-spec.ts | 2 +- test/utils.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/private-api/notes.e2e-spec.ts b/test/private-api/notes.e2e-spec.ts index 46cbf6566..3683f1281 100644 --- a/test/private-api/notes.e2e-spec.ts +++ b/test/private-api/notes.e2e-spec.ts @@ -331,7 +331,7 @@ describe('Notes', () => { // delete the file afterwards await fs.unlink(join(uploadPath, fileName)); } - await fs.rmdir(uploadPath, { recursive: true }); + await fs.rm(uploadPath, { recursive: true }); }); it('fails, when note does not exist', async () => { await agent diff --git a/test/public-api/me.e2e-spec.ts b/test/public-api/me.e2e-spec.ts index 814a6b257..e0e5f312e 100644 --- a/test/public-api/me.e2e-spec.ts +++ b/test/public-api/me.e2e-spec.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -216,7 +216,7 @@ describe('Me', () => { // delete the file afterwards await fs.unlink(join(uploadPath, fileName)); } - await fs.rmdir(uploadPath, { recursive: true }); + await fs.rm(uploadPath, { recursive: true }); }); afterAll(async () => { diff --git a/test/public-api/notes.e2e-spec.ts b/test/public-api/notes.e2e-spec.ts index 154e95372..f0da82a60 100644 --- a/test/public-api/notes.e2e-spec.ts +++ b/test/public-api/notes.e2e-spec.ts @@ -442,7 +442,7 @@ describe('Notes', () => { // delete the file afterwards await fs.unlink(join(uploadPath, fileName)); } - await fs.rmdir(uploadPath, { recursive: true }); + await fs.rm(uploadPath, { recursive: true }); }); it('fails, when note does not exist', async () => { await request(testSetup.app.getHttpServer()) diff --git a/test/utils.ts b/test/utils.ts index 9c00f0bcf..5359a3b02 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -11,7 +11,7 @@ import { promises as fs } from 'fs'; */ export async function ensureDeleted(path: string): Promise { try { - await fs.rmdir(path, { recursive: true }); + await fs.rm(path, { recursive: true }); } catch (e) { if (e.code && e.code == 'ENOENT') { // ignore error, path is already deleted