From 42b8272dd6b395709d00743f21b3ad517f1d56f6 Mon Sep 17 00:00:00 2001 From: itchyny Date: Mon, 20 Nov 2023 15:59:07 +0900 Subject: [PATCH] fix: collect all errors in removeFolders Previously this function returns only the first error when some of the promises fail. But the type annotation suggests that the original intention was to collect all the errors. This commit fixes the error values, and unexpected `TypeError: object is not iterable`. --- packages/playwright-core/src/utils/fileUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/playwright-core/src/utils/fileUtils.ts b/packages/playwright-core/src/utils/fileUtils.ts index 287899d509f0c..751878a8698cd 100644 --- a/packages/playwright-core/src/utils/fileUtils.ts +++ b/packages/playwright-core/src/utils/fileUtils.ts @@ -28,8 +28,8 @@ export async function mkdirIfNeeded(filePath: string) { export async function removeFolders(dirs: string[]): Promise { return await Promise.all(dirs.map((dir: string) => - fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 }) - )).catch(e => e); + fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 }).catch(e => e) + )); } export function canAccessFile(file: string) {