Skip to content

Commit

Permalink
fix: collect all errors in removeFolders
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
itchyny committed Nov 20, 2023
1 parent 3f55587 commit 42b8272
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/playwright-core/src/utils/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export async function mkdirIfNeeded(filePath: string) {

export async function removeFolders(dirs: string[]): Promise<Error[]> {
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) {
Expand Down

0 comments on commit 42b8272

Please sign in to comment.