From 440f5e5d2be2e5b251dfed33eb4d65c5c01a97ba Mon Sep 17 00:00:00 2001 From: itchyny Date: Mon, 20 Nov 2023 18:58:10 +0900 Subject: [PATCH] fix: collect all errors in removeFolders (#28239) This PR fixes https://github.com/microsoft/playwright/pull/27790#pullrequestreview-1738958803. 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 287899d509..751878a869 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) {