mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
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`.
This commit is contained in:
parent
3f55587dd8
commit
440f5e5d2b
@ -28,8 +28,8 @@ export async function mkdirIfNeeded(filePath: string) {
|
|||||||
|
|
||||||
export async function removeFolders(dirs: string[]): Promise<Error[]> {
|
export async function removeFolders(dirs: string[]): Promise<Error[]> {
|
||||||
return await Promise.all(dirs.map((dir: string) =>
|
return await Promise.all(dirs.map((dir: string) =>
|
||||||
fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 })
|
fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 }).catch(e => e)
|
||||||
)).catch(e => e);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canAccessFile(file: string) {
|
export function canAccessFile(file: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user