diff --git a/cli/src/modules/common/cursorModels.test.ts b/cli/src/modules/common/cursorModels.test.ts index 5fd6ecbc..0a759bb4 100644 --- a/cli/src/modules/common/cursorModels.test.ts +++ b/cli/src/modules/common/cursorModels.test.ts @@ -1,5 +1,13 @@ import { afterEach, describe, expect, test, vi } from 'vitest' import { setCursorAcpModelsSnapshot } from '@/cursor/utils/cursorAcpModelsBridge' +import { mkdtempSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' + +// Isolate the on-disk cursor-models cache to this file's own HAPI_HOME so +// parallel vitest workers don't race on the shared $HAPI_HOME/cache path +// (see heavygee/hapi#101). +process.env.HAPI_HOME = mkdtempSync(join(tmpdir(), 'hapi-cursor-models-')) const { spawnMock } = vi.hoisted(() => ({ spawnMock: vi.fn() diff --git a/cli/src/modules/common/cursorModelsSharedCache.test.ts b/cli/src/modules/common/cursorModelsSharedCache.test.ts index db8e1ae8..821f4904 100644 --- a/cli/src/modules/common/cursorModelsSharedCache.test.ts +++ b/cli/src/modules/common/cursorModelsSharedCache.test.ts @@ -1,10 +1,18 @@ import { afterEach, describe, expect, test } from 'vitest'; +import { mkdtempSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; import { readSharedCursorModelsCache, writeSharedCursorModelsCache, _resetSharedCursorModelsCacheForTests } from './cursorModelsSharedCache'; +// Isolate the on-disk cursor-models cache to this file's own HAPI_HOME so +// parallel vitest workers don't race on the shared $HAPI_HOME/cache path +// (see heavygee/hapi#101). +process.env.HAPI_HOME = mkdtempSync(join(tmpdir(), 'hapi-cursor-models-shared-cache-')); + afterEach(() => { _resetSharedCursorModelsCacheForTests(); });