Files
Michael Ramos d3c9de1ef0 Fix annotate terminal startup in large folders
Avoid starving folder annotate sessions by excluding agent work directories and capping folder file-browser scans. Improve the annotate WebTUI panel startup/stop behavior.
2026-07-08 12:33:12 -07:00

27 lines
1.3 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { isFileBrowserExcludedPath } from "./reference-common";
describe("isFileBrowserExcludedPath", () => {
test("matches excluded folders at any path depth", () => {
expect(isFileBrowserExcludedPath("node_modules")).toBe(true);
expect(isFileBrowserExcludedPath("node_modules/pkg/readme.md")).toBe(true);
expect(isFileBrowserExcludedPath("docs/node_modules")).toBe(true);
expect(isFileBrowserExcludedPath("docs/node_modules/pkg/readme.md")).toBe(true);
expect(isFileBrowserExcludedPath("docs/dist")).toBe(true);
expect(isFileBrowserExcludedPath("docs/dist/generated.md")).toBe(true);
expect(isFileBrowserExcludedPath(".claude/worktrees/session/plan.md")).toBe(true);
expect(isFileBrowserExcludedPath("packages/app/.agents/skills/review/SKILL.md")).toBe(true);
});
test("matches exact path segments only", () => {
expect(isFileBrowserExcludedPath("docs/node_modules_backup/readme.md")).toBe(false);
expect(isFileBrowserExcludedPath("docs/build-notes/plan.md")).toBe(false);
expect(isFileBrowserExcludedPath("docs/plan.md")).toBe(false);
});
test("normalizes windows separators and leading slashes", () => {
expect(isFileBrowserExcludedPath("\\repo\\docs\\node_modules")).toBe(true);
expect(isFileBrowserExcludedPath("/repo/docs/node_modules/pkg/readme.md")).toBe(true);
});
});