test(plugins): cover bundled dependency edge cases

This commit is contained in:
Vincent Koc
2026-04-26 20:30:45 -07:00
parent 4878d3e059
commit f60378519c
3 changed files with 99 additions and 4 deletions

View File

@@ -97,6 +97,21 @@ describe("command-path-policy", () => {
hideBanner: true,
ensureCliPath: true,
});
for (const commandPath of [
["plugins", "install"],
["plugins", "list"],
["plugins", "inspect"],
["plugins", "registry"],
["plugins", "doctor"],
]) {
expect(resolveCliCommandPathPolicy(commandPath)).toEqual({
bypassConfigGuard: false,
routeConfigGuard: "never",
loadPlugins: "never",
hideBanner: false,
ensureCliPath: true,
});
}
expect(resolveCliCommandPathPolicy(["cron", "list"])).toEqual({
bypassConfigGuard: true,
routeConfigGuard: "never",

View File

@@ -174,8 +174,17 @@ describe("registerSubCliCommands", () => {
expect(acpAction).toHaveBeenCalledTimes(1);
});
it("does not preload plugin CLI registrations for builtin plugins update", async () => {
process.argv = ["node", "openclaw", "plugins", "update", "lossless-claw"];
it.each([
["plugins update", ["plugins", "update", "lossless-claw"]],
["plugins update --all", ["plugins", "update", "--all"]],
["plugins install", ["plugins", "install", "lossless-claw"]],
["plugins list", ["plugins", "list"]],
["plugins inspect", ["plugins", "inspect", "lossless-claw"]],
["plugins registry --refresh", ["plugins", "registry", "--refresh"]],
["plugins doctor", ["plugins", "doctor"]],
["plugins --help", ["plugins", "--help"]],
])("does not preload plugin CLI registrations for builtin %s", async (_label, args) => {
process.argv = ["node", "openclaw", ...args];
const program = new Command().name("openclaw");
await registerSubCliByName(program, "plugins");