From c2ae76d8b731235db9717e9fed199d751251e7d7 Mon Sep 17 00:00:00 2001 From: jiayiyan <43424880@qq.com> Date: Mon, 18 May 2026 16:24:37 +0800 Subject: [PATCH] fix: make tempDir unique across fast test runs Use a counter to ensure each tempDir call gets a unique directory name, preventing collisions when tests run within the same millisecond. --- workflows/__tests__/differ-adapter.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflows/__tests__/differ-adapter.test.ts b/workflows/__tests__/differ-adapter.test.ts index 3ab1209..9e50e73 100644 --- a/workflows/__tests__/differ-adapter.test.ts +++ b/workflows/__tests__/differ-adapter.test.ts @@ -15,8 +15,9 @@ function makeSpawn(result: MockSpawnResult) { return mock(async (_cmd: string, _args: string[], _opts: SpawnCliConfig) => result); } +let tempDirCounter = 0; function tempDir(): string { - const dir = join(tmpdir(), `differ-test-${Date.now()}`); + const dir = join(tmpdir(), `differ-test-${Date.now()}-${tempDirCounter++}`); mkdirSync(dir, { recursive: true }); return dir; }