Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/cli/src/browser/windowsCrash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,23 @@ describe("windowsChromeCrashRemediation", () => {
),
).toBeUndefined();
});

// The hint only ever renders on win32, so on CI (Linux) the string itself is
// otherwise unasserted. Both shell forms have to be there: `set` is cmd.exe,
// and in PowerShell it resolves to the Set-Variable alias — a shell variable
// that never reaches the child process, so a PowerShell user would follow the
// hint exactly and see no change.
it("names both the cmd.exe and the PowerShell way to set the env var", () => {
const original = process.platform;
Object.defineProperty(process, "platform", { value: "win32", configurable: true });
try {
const hint = windowsChromeCrashRemediation(
"Failed to launch the browser process! Code: 3221225595",
);
expect(hint).toContain('set HYPERFRAMES_BROWSER_PATH="C:\\Program Files');
expect(hint).toContain('$env:HYPERFRAMES_BROWSER_PATH = "C:\\Program Files');
} finally {
Object.defineProperty(process, "platform", { value: original, configurable: true });
}
});
});
7 changes: 7 additions & 0 deletions packages/cli/src/browser/windowsCrash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export function windowsChromeCrashRemediation(errorMessage: string): string | un
"",
' set HYPERFRAMES_BROWSER_PATH="C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"',
"",
// `set` is cmd.exe syntax. In PowerShell it resolves to the Set-Variable
// alias, which makes a shell variable rather than an environment one — it
// never reaches the child process, so the hint would look followed and
// change nothing.
" PowerShell:",
' $env:HYPERFRAMES_BROWSER_PATH = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"',
"",
"Then re-run your command. Any Chrome build works for the screenshot capture path; install a real chrome-headless-shell later if you need the perf-optimized BeginFrame path.",
].join("\n");
}
Loading