mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-03 12:17:03 +00:00
* fix(cli): commands exit without waiting on update checks or telemetry The update and skills checks run in a detached child that refreshes the caches for the next run; the parent only reads the caches. finalizeCli no longer awaits the telemetry flush: the exit handler flushSync() delivers what is queued. The events beacon, feedback and figma error paths stop awaiting flush() too. * fix(cli): retry a failed background check at most once an hour Before starting the background worker, the CLI stamps a per-check attempt time and skips a check it attempted within the hour, so a dead network no longer starts a worker on every command. The stale-pin notice writes onto a fresh read, detached spawns set windowsHide, and a test ties the worker path to its build entry. * fix(cli): a failed-check stamp dated in the future no longer silences update checks
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { expect, it, vi } from "vitest";
|
|
|
|
const checks = vi.hoisted(() => ({
|
|
checkForUpdate: vi.fn(async () => ({})),
|
|
refreshSkillsCache: vi.fn(async () => {
|
|
throw new Error("offline");
|
|
}),
|
|
}));
|
|
vi.mock("./utils/updateCheck.js", () => ({ checkForUpdate: checks.checkForUpdate }));
|
|
vi.mock("./utils/skillsUpdateCheck.js", () => ({ refreshSkillsCache: checks.refreshSkillsCache }));
|
|
|
|
it("runs each check it was handed, and one failing does not stop the other", async () => {
|
|
process.argv = [process.execPath, "backgroundChecksWorker.js", "skills", "update"];
|
|
|
|
await import("./backgroundChecksWorker.js");
|
|
|
|
expect(checks.refreshSkillsCache).toHaveBeenCalledTimes(1);
|
|
expect(checks.checkForUpdate).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
it("skips a check the parent did not find due", async () => {
|
|
vi.resetModules();
|
|
checks.checkForUpdate.mockClear();
|
|
process.argv = [process.execPath, "backgroundChecksWorker.js", "skills"];
|
|
|
|
await import("./backgroundChecksWorker.js");
|
|
|
|
expect(checks.checkForUpdate).not.toHaveBeenCalled();
|
|
});
|