feat(coding-agent): support renamed self-update package

This commit is contained in:
Armin Ronacher
2026-05-07 16:11:06 +02:00
parent 801db80b65
commit 5e1e4c3c88
7 changed files with 460 additions and 56 deletions

View File

@@ -2,6 +2,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import {
checkForNewPiVersion,
comparePackageVersions,
getLatestPiRelease,
getLatestPiVersion,
isNewerPackageVersion,
} from "../src/utils/version-check.js";
@@ -56,6 +57,13 @@ describe("version checks", () => {
);
});
it("returns the active package name from the version check api", async () => {
const fetchMock = vi.fn(async () => Response.json({ packageName: "@new-scope/pi", version: "1.2.4" }));
vi.stubGlobal("fetch", fetchMock);
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({ packageName: "@new-scope/pi", version: "1.2.4" });
});
it("skips api calls when version checks are disabled", async () => {
process.env.PI_SKIP_VERSION_CHECK = "1";
const fetchMock = vi.fn();