























@@ -929,7 +929,12 @@ describe("QmdMemoryManager", () => {
929929const child = createMockChild({ autoClose: false });
930930const pathArg = args[2] ?? "";
931931const name = args[args.indexOf("--name") + 1] ?? "";
932-const pattern = args[args.indexOf("--glob") + 1] ?? args[args.indexOf("--mask") + 1] ?? "";
932+const patternIndex = args.includes("--glob")
933+ ? args.indexOf("--glob") + 1
934+ : args.includes("--mask")
935+ ? args.indexOf("--mask") + 1
936+ : -1;
937+const pattern = patternIndex >= 0 ? (args[patternIndex] ?? "") : "";
933938const hasConflict = [...listedCollections.entries()].some(
934939([existingName, info]) =>
935940existingName !== name && info.path === pathArg && info.pattern === pattern,
@@ -1023,7 +1028,12 @@ describe("QmdMemoryManager", () => {
10231028if (args[0] === "collection" && args[1] === "add") {
10241029const child = createMockChild({ autoClose: false });
10251030const name = args[args.indexOf("--name") + 1] ?? "";
1026-const pattern = args[args.indexOf("--glob") + 1] ?? args[args.indexOf("--mask") + 1] ?? "";
1031+const patternIndex = args.includes("--glob")
1032+ ? args.indexOf("--glob") + 1
1033+ : args.includes("--mask")
1034+ ? args.indexOf("--mask") + 1
1035+ : -1;
1036+const pattern = patternIndex >= 0 ? (args[patternIndex] ?? "") : "";
10271037const attempts = addAttempts.get(name) ?? 0;
10281038addAttempts.set(name, attempts + 1);
10291039if (name === "memory-root-main" && attempts === 0) {
@@ -1097,7 +1107,12 @@ describe("QmdMemoryManager", () => {
10971107if (args[0] === "collection" && args[1] === "add") {
10981108const child = createMockChild({ autoClose: false });
10991109const name = args[args.indexOf("--name") + 1] ?? "";
1100-const pattern = args[args.indexOf("--glob") + 1] ?? args[args.indexOf("--mask") + 1] ?? "";
1110+const patternIndex = args.includes("--glob")
1111+ ? args.indexOf("--glob") + 1
1112+ : args.includes("--mask")
1113+ ? args.indexOf("--mask") + 1
1114+ : -1;
1115+const pattern = patternIndex >= 0 ? (args[patternIndex] ?? "") : "";
11011116added.set(name, pattern);
11021117queueMicrotask(() => child.closeWith(0));
11031118return child;
@@ -1113,7 +1128,7 @@ describe("QmdMemoryManager", () => {
11131128expect(removed).not.toContain("memory-dir-main");
11141129});
111511301116-it("falls back to --mask when qmd collection add rejects --glob", async () => {
1131+it("falls back to --glob when qmd collection add rejects --mask", async () => {
11171132cfg = {
11181133 ...cfg,
11191134memory: {
@@ -1137,8 +1152,8 @@ describe("QmdMemoryManager", () => {
11371152const child = createMockChild({ autoClose: false });
11381153const flag = args.includes("--glob") ? "--glob" : args.includes("--mask") ? "--mask" : "";
11391154addFlagCalls.push(flag);
1140-if (flag === "--glob") {
1141-emitAndClose(child, "stderr", "unknown flag: --glob", 1);
1155+if (flag === "--mask") {
1156+emitAndClose(child, "stderr", "unknown flag: --mask", 1);
11421157return child;
11431158}
11441159queueMicrotask(() => child.closeWith(0));
@@ -1150,7 +1165,7 @@ describe("QmdMemoryManager", () => {
11501165const { manager } = await createManager({ mode: "full" });
11511166await manager.close();
115211671153-expect(addFlagCalls).toEqual(["--glob", "--mask", "--mask"]);
1168+expect(addFlagCalls).toEqual(["--mask", "--glob", "--glob"]);
11541169expect(logWarnMock).toHaveBeenCalledWith(
11551170expect.stringContaining("retrying with legacy compatibility flag"),
11561171);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。