Skip to content

Commit

Permalink
fix: avoid random ENOTEMPTY errors (#2620)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Jan 6, 2023
1 parent 6b3e36d commit 59766fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/coverage-c8/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class C8CoverageProvider implements CoverageProvider {

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

if (!existsSync(this.options.tempDirectory))
await fs.mkdir(this.options.tempDirectory, { recursive: true })
Expand Down Expand Up @@ -131,7 +131,7 @@ export class C8CoverageProvider implements CoverageProvider {
// There will still be a temp directory with some reports when vitest exists,
// but at least it will only contain reports of vitest's internal functions.
if (existsSync(this.options.tempDirectory))
await fs.rm(this.options.tempDirectory, { recursive: true, force: true })
await fs.rm(this.options.tempDirectory, { recursive: true, force: true, maxRetries: 10 })
}
}
function resolveC8Options(options: CoverageC8Options, root: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/coverage-istanbul/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class IstanbulCoverageProvider implements CoverageProvider {

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

this.coverages = []
}
Expand Down

0 comments on commit 59766fa

Please sign in to comment.