fix: Replace rimraf with fs-extra.remove

This commit is contained in:
Joachim Van Herwegen
2021-08-02 09:58:05 +02:00
parent 3cb200328a
commit 2a82c4f06e
7 changed files with 101 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
import type { IModuleState } from 'componentsjs';
import { ComponentsManager } from 'componentsjs';
import * as rimraf from 'rimraf';
import { remove } from 'fs-extra';
import { joinFilePath } from '../../src/util/PathUtil';
let cachedModuleState: IModuleState;
@@ -38,8 +38,8 @@ export function getTestFolder(name: string): string {
return joinFilePath(__dirname, '../tmp', name);
}
export function removeFolder(folder: string): void {
rimraf.sync(folder, { glob: false });
export async function removeFolder(folder: string): Promise<void> {
await remove(folder);
}
export function getDefaultVariables(port: number, baseUrl?: string): Record<string, any> {

View File

@@ -13,10 +13,10 @@ const podConfigJson = joinFilePath(rootFilePath, 'config-pod.json');
const configs: [string, any][] = [
[ 'memory.json', {
teardown: (): void => removeFolder(rootFilePath),
teardown: async(): Promise<void> => removeFolder(rootFilePath),
}],
[ 'filesystem.json', {
teardown: (): void => removeFolder(rootFilePath),
teardown: async(): Promise<void> => removeFolder(rootFilePath),
}],
];

View File

@@ -25,7 +25,7 @@ const stores: [string, any][] = [
}],
[ 'on-disk storage', {
storeConfig: 'storage/backend/file.json',
teardown: (): void => removeFolder(rootFilePath),
teardown: async(): Promise<void> => removeFolder(rootFilePath),
}],
];

View File

@@ -26,7 +26,7 @@ const stores: [string, any][] = [
}],
[ 'on-disk storage', {
storeConfig: 'storage/backend/file.json',
teardown: (): void => removeFolder(rootFilePath),
teardown: async(): Promise<void> => removeFolder(rootFilePath),
}],
];

View File

@@ -22,7 +22,7 @@ const stores: [string, any][] = [
}],
[ 'on-disk storage', {
storeConfig: 'storage/backend/file.json',
teardown: (): void => removeFolder(rootFilePath),
teardown: async(): Promise<void> => removeFolder(rootFilePath),
}],
];