Skip to content

Commit cb34775

Browse files
committed
fix(process-lock): fix test race condition in beforeEach
Root cause: Async cleanup in beforeEach was deleting testDir after creating it, causing ENOENT errors. Fixed by removing async cleanup from beforeEach and relying on: - Unique directory names with hrtime for isolation - Synchronous directory creation in beforeEach - Async cleanup in afterEach - Explicit cleanup before manual mkdir in individual tests All 19 tests now pass locally.
1 parent 8eacea9 commit cb34775

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

test/process-lock.test.ts

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

20-
beforeEach(async () => {
20+
beforeEach(() => {
2121
// Create unique test directory for each test.
2222
// Use process.hrtime.bigint() for higher precision than Date.now()
2323
testDir = path.join(
@@ -26,13 +26,6 @@ describe('process-lock', () => {
2626
)
2727
lockPath = path.join(testDir, 'test.lock')
2828

29-
// Clean up any existing test directory.
30-
try {
31-
await safeDelete(testDir, { force: true })
32-
} catch {
33-
// Ignore cleanup errors.
34-
}
35-
3629
// Ensure test directory exists.
3730
mkdirSync(testDir, { recursive: true })
3831
})

0 commit comments

Comments
 (0)