Skip to content

Commit 66eb281

Browse files
committed
fix(test): ensure clean state in beforeEach for process-lock tests
Add cleanup in beforeEach to prevent test isolation issues. Tests were failing in CI due to leftover lock directories from previous tests causing EEXIST errors.
1 parent 9e85576 commit 66eb281

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test/process-lock.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ describe('process-lock', () => {
1717
let testDir: string
1818
let lockPath: string
1919

20-
beforeEach(() => {
20+
beforeEach(async () => {
2121
// Create unique test directory for each test.
2222
testDir = path.join(
2323
tmpdir(),
2424
`process-lock-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
2525
)
2626
lockPath = path.join(testDir, 'test.lock')
2727

28+
// Clean up any existing test directory.
29+
try {
30+
await safeDelete(testDir, { force: true })
31+
} catch {
32+
// Ignore cleanup errors.
33+
}
34+
2835
// Ensure test directory exists.
2936
mkdirSync(testDir, { recursive: true })
3037
})

0 commit comments

Comments
 (0)