Skip to content

Commit

Permalink
fix: collect all errors in removeFolders (microsoft#28239)
Browse files Browse the repository at this point in the history
This PR fixes
microsoft#27790 (review).
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 440f5e5
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 440f5e5

Please sign in to comment.