MCPcopy Index your code
hub / github.com/continuedev/continue / addToTestDir

Function addToTestDir

core/test/testDir.ts:29–51  ·  view source on GitHub ↗
(pathsOrUris: (string | [string, string])[])

Source from the content-addressed store, hash-verified

27 ["index/index.ts", "hello"] creates index/index.ts with contents "hello"
28*/
29export function addToTestDir(pathsOrUris: (string | [string, string])[]) {
30 // Allow tests to use URIs or local paths
31 const paths = pathsOrUris.map((val) => {
32 if (Array.isArray(val)) {
33 return [localPathOrUriToPath(val[0]), val[1]];
34 } else {
35 return localPathOrUriToPath(val);
36 }
37 });
38
39 for (const p of paths) {
40 const filepath = path.join(TEST_DIR_PATH, Array.isArray(p) ? p[0] : p);
41 fs.mkdirSync(path.dirname(filepath), { recursive: true });
42
43 if (Array.isArray(p)) {
44 fs.writeFileSync(filepath, p[1]);
45 } else if (p.endsWith("/")) {
46 fs.mkdirSync(filepath, { recursive: true });
47 } else {
48 fs.writeFileSync(filepath, "");
49 }
50 }
51}

Calls 1

localPathOrUriToPathFunction · 0.90

Tested by

no test coverage detected