mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
d3c9de1ef0
Avoid starving folder annotate sessions by excluding agent work directories and capping folder file-browser scans. Improve the annotate WebTUI panel startup/stop behavior.
27 lines
1.3 KiB
TypeScript
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);
|
|
});
|
|
});
|