mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +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
21 lines
802 B
TypeScript
21 lines
802 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
const order: string[] = [];
|
|
const telemetry = vi.hoisted(() => ({
|
|
trackEvent: vi.fn(),
|
|
flush: vi.fn(async () => {}),
|
|
flushSync: vi.fn(),
|
|
}));
|
|
vi.mock("../telemetry/client.js", () => telemetry);
|
|
|
|
describe("events", () => {
|
|
it("queues the event, then hands it to the detached sender without waiting on the network", async () => {
|
|
telemetry.trackEvent.mockImplementation(() => order.push("track"));
|
|
telemetry.flushSync.mockImplementation(() => order.push("flushSync"));
|
|
const { default: events } = await import("./events.js");
|
|
await events.run?.({ args: { skill: "hyperframes", event: "skill_invoked" } } as never);
|
|
expect(order).toEqual(["track", "flushSync"]);
|
|
expect(telemetry.flush).not.toHaveBeenCalled();
|
|
});
|
|
});
|