Files
repomix-mirror/tests/shared/tmpDir.test.ts
Kazuki Yamada 72b75f607b refactor(shared): Centralise $TMPDIR/repomix umbrella in shared/tmpDir
intent(tmp-dir): a single grep should find every consumer of the `$TMPDIR/repomix/` umbrella; previously the path was rebuilt independently in mcpToolRuntime and tokenCountCache, with no shared anchor preventing future drift
decision(api-shape): expose only `getRepomixTmpDir()` + the `REPOMIX_TMP_DIR_NAME` constant — callers append their own subdirectory (`mcp-outputs`, `cache`) and own their mkdir/mkdtemp/permissions, since each consumer's lifecycle and creation pattern differs
rejected(scope): folding `--remote`'s `mkdtemp(repomix-)` into the umbrella was considered but skipped — it uses a different prefix-based scheme at the $TMPDIR root, not the shared umbrella, and changing it is a user-visible path change worth handling separately
2026-05-11 23:45:25 +09:00

14 lines
509 B
TypeScript

import os from 'node:os';
import path from 'node:path';
import { describe, expect, it } from 'vitest';
import { getRepomixTmpDir, REPOMIX_TMP_DIR_NAME } from '../../src/shared/tmpDir.js';
describe('shared/tmpDir', () => {
it('returns a path under os.tmpdir() ending with the umbrella name', () => {
const dir = getRepomixTmpDir();
expect(dir.startsWith(os.tmpdir())).toBe(true);
expect(path.basename(dir)).toBe(REPOMIX_TMP_DIR_NAME);
expect(REPOMIX_TMP_DIR_NAME).toBe('repomix');
});
});