test(analyze): isolate cached graph fixtures by unique directory

This commit is contained in:
Rudy Celekli committed 2026-09-28 02:19:46 -04:00
1 parent 1a9c5b678d
commit 62265fa4ce
1 file changed
+4 -3
@@ -24,7 +24,7 @@ import {
type CircularDependency,
type GraphAnalysisResult,
} from '../../src/ruvector/graph-analyzer.js';
import { mkdir, writeFile, rm } from 'fs/promises';
import { mkdir, mkdtemp, writeFile, rm } from 'fs/promises';
import { spawnSync } from 'child_process';
import { createRequire } from 'module';
import { join } from 'path';
@@ -41,8 +41,9 @@ describe('Graph Analyzer', () => {
let testDir: string;
beforeEach(async () => {
testDir = join(tmpdir(), `graph-test-${Date.now()}`);
await mkdir(testDir, { recursive: true });
// Graphs are cached by path. Date.now() can repeat for adjacent tests,
// causing a fixture to receive the preceding test's cached graph.
testDir = await mkdtemp(join(tmpdir(), 'graph-test-'));
});
afterEach(async () => {