fix(cli): check waits for the composition as long as snapshot and render do (#6947)

* test(cli): check waits as long as snapshot for the composition by default

* fix(cli): check waits for the composition as long as snapshot and render do

* docs(cli): check's --timeout default matches snapshot and render

* fix(cli): check's render-ready warning advises a --timeout above the new default

* fix(cli): drop the doc comment on the render-ready warning suffix

* style(cli): format checkBrowser.ts
This commit is contained in:
Miguel Ángel
2026-11-03 23:52:11 +00:00
committed by GitHub
parent 3adc9f130d
commit f487a20b28
6 changed files with 39 additions and 9 deletions
+1 -1
View File
@@ -1211,7 +1211,7 @@ cover every finding from the full check.
| `--max-issues` | Findings to print or return after static collapse (default 80) |
| `--collapse-static` / `--no-collapse-static` | Fold a repeated static finding into one row (default: on) |
| `--tolerance` | Allowed overflow in px before reporting (default 2) |
| `--timeout` | Render-ready budget in ms; also raises page navigation above its 10s floor (default 3000) |
| `--timeout` | Render-ready budget in ms; also raises page navigation above its 10s floor (default 45000, as snapshot and render) |
| `--no-contrast` | Skip the WCAG pass while iterating |
| `--strict` | Exit non-zero on warnings too (default: errors only) |
| `--caption-zone "<x0=..;y0=..;x1=..;y1=..>"` | Opt-in band gate. Flags a text element's DOM box that overlaps the fractional band. Optional `severity` and `seek`. |
+19
View File
@@ -4,6 +4,7 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "nod
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import { DEFAULT_CONFIG } from "@hyperframes/engine";
const trackCheckReport = vi.fn();
vi.mock("../telemetry/events.js", () => ({
@@ -498,6 +499,24 @@ describe("skip contrast in motion", () => {
});
});
it("waits for the composition as long as snapshot and render do unless --timeout says otherwise", async () => {
const { report } = await runScenario(fakeDriver());
const runPipeline = vi.fn(async (_project: ProjectDir, _options: CheckOptions) => report);
vi.spyOn(console, "log").mockImplementation(() => undefined);
const command = createCheckCommand({
resolveProject: () => PROJECT,
runPipeline,
prepareMedia: vi.fn(async () => []),
withMeta: (value) => value,
});
await runCommand(command, { rawArgs: ["--json"] });
await runCommand(command, { rawArgs: ["--json", "--timeout", "20s"] });
expect(runPipeline.mock.calls[0]?.[1].timeout).toBe(DEFAULT_CONFIG.playerReadyTimeout);
expect(runPipeline.mock.calls[1]?.[1].timeout).toBe(20_000);
});
it("parses the caption-zone grammar and enables the frame gate", async () => {
const { report } = await runScenario(fakeDriver());
const runPipeline = vi.fn(async (_project: ProjectDir, _options: CheckOptions) => report);
+2 -2
View File
@@ -212,8 +212,8 @@ const CHECK_COMMAND_ARGS = {
timeout: {
type: "string",
description:
"Initial render-ready timeout in ms, or with a unit (45s, 2m); also sets the navigation minimum (10s floor, default: 10000)",
default: "10000",
"Initial render-ready timeout in ms, or with a unit (45s, 2m); also sets the navigation minimum (10s floor, default: 45000, as snapshot and render)",
default: String(DEFAULT_CHECK_OPTIONS.timeout),
},
contrast: {
type: "boolean",
@@ -1,6 +1,7 @@
// @vitest-environment happy-dom
// fallow-ignore-file code-duplication
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { DEFAULT_CONFIG } from "@hyperframes/engine";
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import os, { tmpdir } from "node:os";
import { join } from "node:path";
@@ -23,6 +24,7 @@ import {
collectSeekClock,
mergeHelperDrafts,
samplingBrowserCount,
RENDER_READY_WARNING_SUFFIX,
} from "./checkBrowser.js";
import { CheckDeadline } from "./checkDeadline.js";
import { closeManagedBrowser } from "../browser/launch.js";
@@ -2221,3 +2223,10 @@ describe("finding frame capture", () => {
}
});
});
describe("the render-ready warning's advice", () => {
it("names a --timeout above the default, so following it never lowers the wait", () => {
const example = /for example (\d+)s\)/.exec(RENDER_READY_WARNING_SUFFIX)?.[1];
expect(Number(example) * 1000).toBeGreaterThan(DEFAULT_CONFIG.playerReadyTimeout);
});
});
+6 -5
View File
@@ -1,3 +1,4 @@
import { DEFAULT_CONFIG } from "@hyperframes/engine";
import type { CheckDeadline } from "./checkDeadline.js";
import { SEEK_SETTLES_BEFORE_PROTOCOL_TIMEOUT_MS } from "../capture/captureTimeout.js";
import { logCheckProgress } from "./checkProgress.js";
@@ -92,6 +93,8 @@ import type {
} from "./checkTypes.js";
import type { ProjectDir } from "./project.js";
export const RENDER_READY_WARNING_SUFFIX = `the scene may still be building, so results can miss late content; raise --timeout (for example ${(DEFAULT_CONFIG.playerReadyTimeout * 2) / 1000}s)`;
interface RuntimeDraft {
code: string;
severity: CheckSeverity;
@@ -195,7 +198,7 @@ function startCopyHeartbeat(
/**
* Awaits the H.264 authoring proxy for every browser-hostile local video
* asset in `html` BEFORE the timed render-ready wait starts. `check`'s
* render-ready wait defaults to 3000ms (`DEFAULT_CHECK_OPTIONS.timeout`,
* render-ready wait defaults to 45 s (`DEFAULT_CHECK_OPTIONS.timeout`,
* passed through as `renderReadyTimeoutMs`), and a cold `.transcode-cache`
* cannot fit inside that window — without this, a project's first
* hostile-asset check (e.g. a fresh CI checkout) would race the timeout
@@ -381,8 +384,7 @@ export async function runBrowserCheck(
const session = await openSettledCompositionPage(html, server.url, {
navigationTimeoutMs: options.timeout,
renderReadyTimeoutMs: options.timeout,
renderReadyWarningSuffix:
"the scene may still be building, so results can miss late content; raise --timeout (for example 20s)",
renderReadyWarningSuffix: RENDER_READY_WARNING_SUFFIX,
prelaunched,
browserGpuMode: options.browserGpuMode ?? resolveCliChromeGpuMode(),
signal: deadline?.signal,
@@ -538,8 +540,7 @@ async function openHelperSession(
const session = await openSettledCompositionPage(html, url, {
navigationTimeoutMs: options.timeout,
renderReadyTimeoutMs: options.timeout,
renderReadyWarningSuffix:
"the scene may still be building, so results can miss late content; raise --timeout (for example 20s)",
renderReadyWarningSuffix: RENDER_READY_WARNING_SUFFIX,
browserGpuMode: options.browserGpuMode ?? resolveCliChromeGpuMode(),
signal: owner.signal,
onBrowser: owner.onBrowser,
+2 -1
View File
@@ -1,3 +1,4 @@
import { DEFAULT_CONFIG } from "@hyperframes/engine";
import { BrowserCleanupError, onStopSignal } from "../browser/launch.js";
import type { CheckProgress } from "./checkProgress.js";
import {
@@ -120,7 +121,7 @@ export const DEFAULT_CHECK_OPTIONS: CheckOptions = {
maxIssues: 80,
collapseStatic: true,
tolerance: 2,
timeout: 10_000,
timeout: DEFAULT_CONFIG.playerReadyTimeout,
contrast: true,
strict: false,
snapshots: false,