mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 02:46:22 +00:00
fix(update): reject openclaw source package targets
This commit is contained in:
@@ -2074,22 +2074,6 @@ describe("update-cli", () => {
|
||||
},
|
||||
expectedSpec: "openclaw@next",
|
||||
},
|
||||
{
|
||||
name: "main shorthand",
|
||||
run: async () => {
|
||||
mockPackageInstallStatus(createCaseDir("openclaw-update"));
|
||||
await updateCommand({ yes: true, tag: "main" });
|
||||
},
|
||||
expectedSpec: "github:openclaw/openclaw#main",
|
||||
},
|
||||
{
|
||||
name: "explicit git package spec",
|
||||
run: async () => {
|
||||
mockPackageInstallStatus(createCaseDir("openclaw-update"));
|
||||
await updateCommand({ yes: true, tag: "github:openclaw/openclaw#main" });
|
||||
},
|
||||
expectedSpec: "github:openclaw/openclaw#main",
|
||||
},
|
||||
{
|
||||
name: "OPENCLAW_UPDATE_PACKAGE_SPEC override",
|
||||
run: async () => {
|
||||
@@ -2116,6 +2100,22 @@ describe("update-cli", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["main", "github:openclaw/openclaw#main", "openclaw@github:openclaw/openclaw#main"])(
|
||||
"rejects OpenClaw GitHub source package updates: %s",
|
||||
async (tag) => {
|
||||
mockPackageInstallStatus(createCaseDir("openclaw-update"));
|
||||
|
||||
await updateCommand({ yes: true, tag });
|
||||
|
||||
expect(packageInstallCommandCall()).toBeUndefined();
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
const errors = vi.mocked(defaultRuntime.error).mock.calls.map((call) => String(call[0]));
|
||||
expect(errors.join("\n")).toContain("Unsupported package update target");
|
||||
expect(errors.join("\n")).toContain("openclaw/openclaw");
|
||||
expect(errors.join("\n")).toContain("openclaw update --channel dev");
|
||||
},
|
||||
);
|
||||
|
||||
it("fails package updates when the installed correction version does not match the requested target", async () => {
|
||||
const tempDir = createCaseDir("openclaw-update");
|
||||
const nodeModules = path.join(tempDir, "node_modules");
|
||||
|
||||
Reference in New Issue
Block a user