MCPcopy
hub / github.com/opentrace/opentrace / readAllFiles

Function readAllFiles

ui/src/components/pipeline/__tests__/fixture.test.ts:46–66  ·  view source on GitHub ↗
(
  dir: string,
  root: string = dir,
)

Source from the content-addressed store, hash-verified

44);
45
46async function readAllFiles(
47 dir: string,
48 root: string = dir,
49): Promise<Array<{ path: string; content: string }>> {
50 const entries = await readdir(dir, { withFileTypes: true });
51 const results: Array<{ path: string; content: string }> = [];
52 for (const entry of entries) {
53 const fullPath = join(dir, entry.name);
54 if (entry.isDirectory()) {
55 // Pass the original root down so paths are relative to the fixture root,
56 // not the current recursion level.
57 results.push(...(await readAllFiles(fullPath, root)));
58 } else {
59 results.push({
60 path: relative(root, fullPath),
61 content: await readFile(fullPath, 'utf-8'),
62 });
63 }
64 }
65 return results;
66}
67
68function runAndLog(
69 files: Array<{ path: string; content: string }>,

Callers 1

fixture.test.tsFile · 0.70

Calls 3

readdirFunction · 0.85
readFileFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected