Skip to content

Commit 59766fa

Browse files
authoredJan 6, 2023
fix: avoid random ENOTEMPTY errors (#2620)
1 parent 6b3e36d commit 59766fa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎packages/coverage-c8/src/provider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class C8CoverageProvider implements CoverageProvider {
3434

3535
async clean(clean = true) {
3636
if (clean && existsSync(this.options.reportsDirectory))
37-
await fs.rm(this.options.reportsDirectory, { recursive: true, force: true })
37+
await fs.rm(this.options.reportsDirectory, { recursive: true, force: true, maxRetries: 10 })
3838

3939
if (!existsSync(this.options.tempDirectory))
4040
await fs.mkdir(this.options.tempDirectory, { recursive: true })
@@ -131,7 +131,7 @@ export class C8CoverageProvider implements CoverageProvider {
131131
// There will still be a temp directory with some reports when vitest exists,
132132
// but at least it will only contain reports of vitest's internal functions.
133133
if (existsSync(this.options.tempDirectory))
134-
await fs.rm(this.options.tempDirectory, { recursive: true, force: true })
134+
await fs.rm(this.options.tempDirectory, { recursive: true, force: true, maxRetries: 10 })
135135
}
136136
}
137137
function resolveC8Options(options: CoverageC8Options, root: string) {

‎packages/coverage-istanbul/src/provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class IstanbulCoverageProvider implements CoverageProvider {
9393

9494
async clean(clean = true) {
9595
if (clean && existsSync(this.options.reportsDirectory))
96-
await fs.rm(this.options.reportsDirectory, { recursive: true, force: true })
96+
await fs.rm(this.options.reportsDirectory, { recursive: true, force: true, maxRetries: 10 })
9797

9898
this.coverages = []
9999
}

0 commit comments

Comments
 (0)
Please sign in to comment.