MCPcopy Create free account
hub / github.com/backnotprop/plannotator / createTempProject

Function createTempProject

packages/server/resolve-file.test.ts:21–33  ·  view source on GitHub ↗
(
  files: Record<string, string> = {},
  baseDir = join(tmpdir(), "plannotator-resolve-file-"),
)

Source from the content-addressed store, hash-verified

19const tempDirs: string[] = [];
20
21function createTempProject(
22 files: Record<string, string> = {},
23 baseDir = join(tmpdir(), "plannotator-resolve-file-"),
24): string {
25 const root = mkdtempSync(baseDir);
26 tempDirs.push(root);
27 for (const [relativePath, content] of Object.entries(files)) {
28 const full = join(root, relativePath);
29 mkdirSync(join(full, ".."), { recursive: true });
30 writeFileSync(full, content);
31 }
32 return root;
33}
34
35afterEach(() => {
36 for (const dir of tempDirs.splice(0)) {

Callers 1

Calls 2

entriesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected