mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:10:42 +00:00
refactor(update): extract package manager bootstrap logic
This commit is contained in:
@@ -26,19 +26,34 @@ function makeResult(
|
||||
}
|
||||
|
||||
describe("inferUpdateFailureHints", () => {
|
||||
it("returns a package-manager bootstrap hint for required manager failures", () => {
|
||||
it("returns a package-manager bootstrap hint for pnpm npm-bootstrap failures", () => {
|
||||
const result = {
|
||||
status: "error",
|
||||
mode: "git",
|
||||
reason: "required-manager-unavailable",
|
||||
reason: "pnpm-npm-bootstrap-failed",
|
||||
steps: [],
|
||||
durationMs: 1,
|
||||
} satisfies UpdateRunResult;
|
||||
|
||||
const hints = inferUpdateFailureHints(result);
|
||||
|
||||
expect(hints.join("\n")).toContain("requires its declared package manager");
|
||||
expect(hints.join("\n")).toContain("Install the missing package manager manually");
|
||||
expect(hints.join("\n")).toContain("bootstrap pnpm from npm");
|
||||
expect(hints.join("\n")).toContain("Install pnpm manually");
|
||||
});
|
||||
|
||||
it("returns a corepack hint when corepack is missing", () => {
|
||||
const result = {
|
||||
status: "error",
|
||||
mode: "git",
|
||||
reason: "pnpm-corepack-missing",
|
||||
steps: [],
|
||||
durationMs: 1,
|
||||
} satisfies UpdateRunResult;
|
||||
|
||||
const hints = inferUpdateFailureHints(result);
|
||||
|
||||
expect(hints.join("\n")).toContain("corepack is missing");
|
||||
expect(hints.join("\n")).toContain("Install pnpm manually");
|
||||
});
|
||||
|
||||
it("returns EACCES hint for global update permission failures", () => {
|
||||
|
||||
Reference in New Issue
Block a user