Skip to content

Commit 384fdc4

Browse files
committed
test(engine): skip the browser FX render cases when there is no browser
CI's `Test` job was red on this PR with four failures, all the same cause: Failed to launch the browser process: spawn /home/runner/.cache/hyperframes/chrome/chrome-headless-shell The job installs ffmpeg and no browser, deliberately — every other suite that needs an external binary already guards on it (`describe.skipIf(!HAS_FFMPEG)`). These cases were the only ones assuming a Chrome, so they failed on an absent dependency rather than on anything about the code. Guards on `resolveHeadlessShellPath()` — the same resolver `acquireBrowser` launches through, so the check cannot drift from the thing it guards the way a hard-coded cache path would. A configured path that does not exist throws; that is caught and read as "cannot run here". Checked both directions rather than just the green one: with a browser all 11 cases run and pass, and with `HYPERFRAMES_BROWSER_PATH` pointed at a missing binary exactly 3 skip and the other 8 still run. A guard that silently skipped everything would have looked identical in CI. They keep their value where it exists — every developer machine, and any job that has run `hyperframes browser ensure`. Not touched: the CodeQL failure on this PR is a run from 2026-08-07, five days and several force-pushes stale. None of the 17 open repo alerts are in files this PR changes; it re-runs on this push.
1 parent f75e5a8 commit 384fdc4

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

packages/engine/src/services/audioFxRender.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
66
import { applyVolumeEnvelopeToWav } from "./audioVolumeEnvelope.js";
77
import { defaultAudioFxParams, type HfAudioFxChain } from "@hyperframes/core/audio-fx";
88
import { applyAudioFxChain, AudioFxRenderError, readWav, writeWav } from "./audioFxRender.js";
9+
import { resolveHeadlessShellPath } from "./browserManager.js";
10+
11+
/**
12+
* Whether a Chrome is actually on this machine, asked the same way the render
13+
* asks — `resolveHeadlessShellPath` is what `acquireBrowser` resolves through,
14+
* so this cannot drift from the thing it is guarding the way a hard-coded cache
15+
* path would.
16+
*
17+
* The repo's `Test` job installs ffmpeg and no browser, on purpose. Without
18+
* this guard the four browser cases below fail there with a spawn error that
19+
* says nothing about the code under test, and the same pattern already covers
20+
* the ffmpeg-dependent suites (`describe.skipIf(!HAS_FFMPEG)`).
21+
*
22+
* They still run wherever a browser exists — every developer machine, and any
23+
* job that has run `hyperframes browser ensure`.
24+
*/
25+
const HAS_BROWSER = ((): boolean => {
26+
try {
27+
return Boolean(resolveHeadlessShellPath());
28+
} catch {
29+
// An explicitly-configured path that does not exist throws. That is a
30+
// broken environment rather than an absent browser, but either way these
31+
// cases cannot run.
32+
return false;
33+
}
34+
})();
935

1036
const SR = 48000;
1137

@@ -150,7 +176,7 @@ describe("applyAudioFxChain", () => {
150176
* are the only place that proves the injected runtime loads and processes
151177
* audio, so they are worth the seconds they cost.
152178
*/
153-
describe("browser render", () => {
179+
describe.skipIf(!HAS_BROWSER)("browser render", () => {
154180
it("notches out the tone it is tuned to", async () => {
155181
const input = join(dir, "in.wav");
156182
tone(input);

0 commit comments

Comments
 (0)