mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
Layout findings now distinguish held defects from entrance/exit transients: a dynamic issue seen at a single grid sample demotes to info, while content_overlap held across two-plus samples (or 500ms+) promotes to error, resolving the long-standing re-promotion TODO. Static compositions keep their severity. check gains a sweep_static error when a 3s+ composition shows zero geometry change across every sample (a frozen timeline makes every green verdict unreliable); skipped when the motion sidecar already reported motion_frozen. text_occluded findings carry a coveredFraction; atomic labels (short, no whitespace) flag on any cover while prose needs 15%, since partial cover changes what a short label reads as. Deprecation-test scaffolding consolidates into deprecationTestHarness; tier logic and logger tests restructured under the complexity gate without suppression markers. Detection mechanics adapted from Adam Rosler's open-sourced visual-linter design (github.com/Adam-Rosler/hyperframes-visual-linter-design); the elementFromPoint paint model, opt-out attributes, and single-audit architecture are unchanged.
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import {
|
|
bundleToSingleHtmlFailureMock,
|
|
metaDescription,
|
|
resolveProjectMock,
|
|
runAndCaptureStdio,
|
|
runAndFindJsonLogCall,
|
|
runAndParseJsonEnvelope,
|
|
} from "./deprecationTestHarness.js";
|
|
|
|
// resolveProject and bundleToSingleHtml are both reached via a dynamic
|
|
// `await import(...)` inside layout.ts's run() / runLayoutAudit(), so
|
|
// vi.mock intercepts them the same way it would a static import. Mocking
|
|
// resolveProject skips real filesystem project resolution; mocking
|
|
// bundleToSingleHtml gives a deterministic, fast failure well before any
|
|
// real browser or network work — exercising 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 { createInspectCommand } from "./layout.js";
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
describe("layout command deprecation (U5)", () => {
|
|
it("marks both the layout and inspect command names' shared description as deprecated", () => {
|
|
expect(metaDescription(createInspectCommand("layout"))).toContain("(deprecated, use check)");
|
|
expect(metaDescription(createInspectCommand("inspect"))).toContain("(deprecated, use check)");
|
|
});
|
|
|
|
it("prints a one-line deprecation notice to stderr and never to stdout", async () => {
|
|
const { stderrText, stdoutText } = await runAndCaptureStdio(createInspectCommand("layout"));
|
|
expect(stderrText).toContain("hyperframes layout");
|
|
expect(stderrText).toContain("hyperframes check");
|
|
expect(stdoutText).toBe("");
|
|
});
|
|
|
|
it("--json output is valid JSON with _meta.deprecated === true on failure", async () => {
|
|
const { parsed } = await runAndParseJsonEnvelope(createInspectCommand("layout"));
|
|
expect(parsed.ok).toBe(false);
|
|
expect(parsed._meta.deprecated).toBe(true);
|
|
});
|
|
|
|
it("the inspect command name produces the same _meta.deprecated === true envelope", async () => {
|
|
const jsonCall = await runAndFindJsonLogCall(createInspectCommand("inspect"));
|
|
const parsed = JSON.parse(String(jsonCall?.[0]));
|
|
expect(parsed._meta.deprecated).toBe(true);
|
|
});
|
|
});
|