mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-12 22:26:08 -04: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
|
// delete the file afterwards
|
||||||
await fs.unlink(join(uploadPath, fileName));
|
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 () => {
|
it('fails, when note does not exist', async () => {
|
||||||
await agent
|
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
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
@ -216,7 +216,7 @@ describe('Me', () => {
|
||||||
// delete the file afterwards
|
// delete the file afterwards
|
||||||
await fs.unlink(join(uploadPath, fileName));
|
await fs.unlink(join(uploadPath, fileName));
|
||||||
}
|
}
|
||||||
await fs.rmdir(uploadPath, { recursive: true });
|
await fs.rm(uploadPath, { recursive: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
@ -442,7 +442,7 @@ describe('Notes', () => {
|
||||||
// delete the file afterwards
|
// delete the file afterwards
|
||||||
await fs.unlink(join(uploadPath, fileName));
|
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 () => {
|
it('fails, when note does not exist', async () => {
|
||||||
await request(testSetup.app.getHttpServer())
|
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
|
* 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> {
|
export async function ensureDeleted(path: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await fs.rmdir(path, { recursive: true });
|
await fs.rm(path, { recursive: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code && e.code == 'ENOENT') {
|
if (e.code && e.code == 'ENOENT') {
|
||||||
// ignore error, path is already deleted
|
// ignore error, path is already deleted
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue