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 <git@innay.de>
This commit is contained in:
Yannick Bungers 2022-01-30 22:00:17 +01:00 committed by David Mehren
parent e4a9562455
commit 42ad99e20b
4 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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 () => {

View file

@ -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())

View file

@ -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<void> {
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