Skip to content

Commit 49004a2

Browse files
committed
fix(test): use Promise.allSettled with retry opts for afterEach cleanup
Ensures both outDir and distDir are cleaned up even if one removal fails, and adds maxRetries/retryDelay for transient fs errors.
1 parent 337f2a7 commit 49004a2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/devframe/src/adapters/build.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ describe('createBuild', () => {
2626
})
2727

2828
afterEach(async () => {
29-
await fs.rm(outDir, { recursive: true, force: true })
30-
await fs.rm(distDir, { recursive: true, force: true })
29+
const rmOpts = { recursive: true, force: true, maxRetries: 3, retryDelay: 100 } as const
30+
await Promise.allSettled([
31+
fs.rm(outDir, rmOpts).catch((err) => {
32+
console.error(`Failed to cleanup outDir at ${outDir}:`, err)
33+
}),
34+
fs.rm(distDir, rmOpts).catch((err) => {
35+
console.error(`Failed to cleanup distDir at ${distDir}:`, err)
36+
}),
37+
])
3138
})
3239

3340
it('throws when no distDir is provided', async () => {

0 commit comments

Comments
 (0)