further testing for walkDir
This commit is contained in:
parent
9b0efb352d
commit
2e2a645c60
2 changed files with 29 additions and 4 deletions
|
|
@ -60,6 +60,11 @@ export const DEFAULT_IGNORE_FILETYPES = [
|
|||
"*.gcno",
|
||||
"go.sum",
|
||||
".env",
|
||||
".gitignore",
|
||||
".gitkeep",
|
||||
".continueignore",
|
||||
"config.json",
|
||||
"*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt
|
||||
];
|
||||
export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES);
|
||||
export const DEFAULT_IGNORE_DIRS = [
|
||||
|
|
|
|||
|
|
@ -232,20 +232,35 @@ describe("walkDir", () => {
|
|||
);
|
||||
});
|
||||
|
||||
test.skip("should walk continue repo", async () => {
|
||||
test("should walk continue repo without getting any files of the default ignore types", async () => {
|
||||
const results = await walkDir(path.join(__dirname, "..", ".."), ide, {
|
||||
ignoreFiles: [".gitignore", ".continueignore"],
|
||||
});
|
||||
console.log(results);
|
||||
expect(results.length).toBeGreaterThan(0);
|
||||
expect(results.some((file) => file.includes("/node_modules/"))).toBe(false);
|
||||
expect(results.some((file) => file.includes("/.git/"))).toBe(false);
|
||||
expect(
|
||||
results.some(
|
||||
(file) =>
|
||||
file.endsWith(".gitignore") ||
|
||||
file.endsWith(".continueignore") ||
|
||||
file.endsWith("package-lock.json"),
|
||||
),
|
||||
).toBe(false);
|
||||
// At some point we will cross this number, but in case we leap past it suddenly I think we'd want to investigate why
|
||||
expect(results.length).toBeLessThan(1500);
|
||||
});
|
||||
|
||||
test.skip("should skip .git and node_modules folders", async () => {
|
||||
test("should skip .git and node_modules folders", async () => {
|
||||
const files = [
|
||||
"a.txt",
|
||||
".git/",
|
||||
".git/config",
|
||||
".git/HEAD",
|
||||
".git/objects/",
|
||||
".git/objects/1234567890abcdef",
|
||||
"node_modules/",
|
||||
"node_modules/package/",
|
||||
"node_modules/package/index.js",
|
||||
"src/",
|
||||
"src/index.ts",
|
||||
|
|
@ -253,7 +268,12 @@ describe("walkDir", () => {
|
|||
buildTestDir(files);
|
||||
await expectPaths(
|
||||
["a.txt", "src/index.ts"],
|
||||
[".git/config", ".git/HEAD", "node_modules/package/index.js"],
|
||||
[
|
||||
".git/config",
|
||||
".git/HEAD",
|
||||
"node_modules/package/index.js",
|
||||
".git/objects/1234567890abcdef",
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue