Files
hyperframes/packages/cli/src/commands/inspect.test.ts
T
Miguel Angel Simon Sierra cea3458016 refactor(cli): single-source-of-truth pass over the check branch
Every duplicated decision gets one owner: rectToBbox lives in checkTypes
(was verbatim in pipeline and browser layers); the audit seek tuning is
one exported AUDIT_SEEK_OPTIONS consumed by check and the deprecated
inspect path; zoom padding/scale defaults export from the capture module
instead of re-literalized in three files; the optional run_id property
is built by one helper across all three telemetry events; check's
--max-transition-samples parsing reuses its own positiveInteger helper;
validate drops a leftover re-export and redundant explicit-default args
go away.

Tests: the contrast candidate round-trip gains a real integration
anchor (the actual browser script eval'd in-page, a wrapper asserting
finish receives the page-script bbox shape) replacing regex-over-source
as the primary guard; the redundant geometry source-golden and a
duplicated deprecation-envelope assertion are dropped.
2026-07-10 13:52:31 -04:00

34 lines
1.3 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from "vitest";
import {
bundleToSingleHtmlFailureMock,
metaDescription,
resolveProjectMock,
runAndCaptureStdio,
} from "./deprecationTestHarness.js";
// See layout.test.ts for why these two dynamic-import targets are mocked:
// resolveProject skips real filesystem resolution, and bundleToSingleHtml
// gives a fast, deterministic failure that exercises run()'s outer catch
// (the JSON failure envelope) without needing headless Chrome.
vi.mock("../utils/project.js", () => resolveProjectMock());
vi.mock("@hyperframes/core/compiler", () => bundleToSingleHtmlFailureMock());
import inspectCommand from "./inspect.js";
afterEach(() => {
vi.restoreAllMocks();
});
describe("inspect command deprecation (U5)", () => {
it("is the compatibility alias for layout, sharing its deprecated description", () => {
expect(metaDescription(inspectCommand)).toContain("(deprecated, use check)");
});
it("prints a one-line deprecation notice naming 'inspect' on stderr, never stdout", async () => {
const { stderrText, stdoutText } = await runAndCaptureStdio(inspectCommand);
expect(stderrText).toContain("hyperframes inspect");
expect(stderrText).toContain("hyperframes check");
expect(stdoutText).toBe("");
});
});