Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid random ENOTEMPTY errors #2620

Merged
merged 1 commit into from Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/coverage-c8/src/provider.ts
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 @@ -109,7 +109,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
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