Files
hyperframes/skills/embedded-captions/scripts/hf-cli.test.mjs
Miguel Ángel 50e7a59aef fix: check, snapshot and renders use the pinned Chrome, not an older one another tool cached (#5900)
* fix(cli): check and snapshot use the pinned Chrome, not an older one another tool cached

* fix(cli): keep the browser-order comment within the line limit

* fix(engine): renders that resolve their own browser follow the same pinned-first rule

* fix(engine): keep the browser rule's reasoning in the PR, not new comments

* fix: a shared-cache shell is used only if it starts, after the pinned build

* fix(engine): import the shared-shell pick, and probe shells with a blank page

* fix(skills): caption scripts launch the browser the CLI chooses

* chore(skills): regenerate the skills manifest for the caption scripts
2026-10-19 20:00:25 +00:00

29 lines
1.1 KiB
JavaScript

import assert from "node:assert/strict";
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { createRequire } from "node:module";
import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
const { hfBrowser } = createRequire(import.meta.url)("./hf-cli.cjs");
test("caption scripts launch the browser `hyperframes browser path` prints", (t) => {
const root = mkdtempSync(join(tmpdir(), "hf-browser-"));
t.after(() => rmSync(root, { recursive: true, force: true }));
const shell = join(root, "chrome-headless-shell");
writeFileSync(shell, "");
const cliDir = join(root, "hf/packages/cli/dist");
mkdirSync(cliDir, { recursive: true });
writeFileSync(
join(cliDir, "cli.js"),
`if (process.argv.slice(2).join(" ") === "browser path") console.log(${JSON.stringify(shell)});`,
);
const before = process.env.HYPERFRAMES_ROOT;
process.env.HYPERFRAMES_ROOT = join(root, "hf");
t.after(() => {
if (before === undefined) delete process.env.HYPERFRAMES_ROOT;
else process.env.HYPERFRAMES_ROOT = before;
});
assert.equal(hfBrowser(), shell);
});