@@ -9,6 +9,7 @@ import type { Browser, Page, PuppeteerNode } from "puppeteer-core";
99
1010import type { CaptureMode } from "./browserLeasePool.js" ;
1111import { managedChromeVersion } from "./chromeHostCeiling.js" ;
12+ import { resolveConfig } from "../config.js" ;
1213
1314import {
1415 _resetAutoBrowserGpuModeCacheForTests ,
@@ -818,6 +819,12 @@ describe("resolveHeadlessShellPath", () => {
818819 const originalHeadlessShellPath = process . env . PRODUCER_HEADLESS_SHELL_PATH ;
819820 const originalHyperframesBrowserPath = process . env . HYPERFRAMES_BROWSER_PATH ;
820821
822+ // A runner may export either var (the Windows job sets HYPERFRAMES_BROWSER_PATH); each case sets its own.
823+ beforeEach ( ( ) => {
824+ delete process . env . PRODUCER_HEADLESS_SHELL_PATH ;
825+ delete process . env . HYPERFRAMES_BROWSER_PATH ;
826+ } ) ;
827+
821828 afterEach ( ( ) => {
822829 if ( originalHeadlessShellPath === undefined ) delete process . env . PRODUCER_HEADLESS_SHELL_PATH ;
823830 else process . env . PRODUCER_HEADLESS_SHELL_PATH = originalHeadlessShellPath ;
@@ -849,6 +856,22 @@ describe("resolveHeadlessShellPath", () => {
849856 }
850857 } ) ;
851858
859+ it ( "keeps that precedence through a render's resolved engine config" , ( ) => {
860+ const dir = mkdtempSync ( join ( tmpdir ( ) , "hyperframes-engine-browser-env-" ) ) ;
861+ try {
862+ const cliChoice = join ( dir , "chosen-browser" ) ;
863+ const other = join ( dir , "other-browser" ) ;
864+ writeFileSync ( cliChoice , "" ) ;
865+ writeFileSync ( other , "" ) ;
866+ process . env . HYPERFRAMES_BROWSER_PATH = cliChoice ;
867+ process . env . PRODUCER_HEADLESS_SHELL_PATH = other ;
868+
869+ expect ( resolveHeadlessShellPath ( resolveConfig ( ) ) ) . toBe ( cliChoice ) ;
870+ } finally {
871+ rmSync ( dir , { recursive : true , force : true } ) ;
872+ }
873+ } ) ;
874+
852875 it ( "uses HYPERFRAMES_BROWSER_PATH when the CLI resolved a browser explicitly" , ( ) => {
853876 const dir = mkdtempSync ( join ( tmpdir ( ) , "hyperframes-engine-browser-env-" ) ) ;
854877 try {
0 commit comments