mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 21:42:19 +00:00
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:
parent
e4a9562455
commit
42ad99e20b
4 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue