test(cursor): remove per-file temp HAPI homes after cursor-models suites (#1269)

Follow-up to #1268. The per-file `mkdtempSync`/`join(tmpdir(), ...)` HAPI
homes in the cursor-models test cluster were never removed, so every run
leaked a directory into the system temp dir (afterEach only cleared the
cache file inside them). Save/restore HAPI_HOME and recursively remove
each per-file temp root in teardown across all three cursor-models test
files (cursorModels, cursorModelsSharedCache, and the stale-lock test that
had the same pattern). No source/runtime change.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
HeavyGee
2026-07-31 11:45:34 +01:00
committed by GitHub
co-authored by Cursor
parent c5f1928eb0
commit c7afc50321
3 changed files with 30 additions and 7 deletions
@@ -1,4 +1,4 @@
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { afterEach, describe, expect, test, vi } from 'vitest';
@@ -46,6 +46,9 @@ describe('listCursorModels stale ACP lock', () => {
} else {
process.env.HAPI_HOME = previousHome;
}
// Remove the per-file temp home so runs don't leak dirs into the system
// temp dir (the test creates it under tmpdir() but never cleaned it up).
rmSync(testHome, { recursive: true, force: true });
});
test('runs cold ACP probe after clearing a stale cross-process lock', async () => {