test(engine): browser pool tests never start the host's cached Chrome (#7759)

This commit is contained in:
Miguel Ángel
2026-11-16 06:51:05 +00:00
committed by GitHub
parent b2e6076b7e
commit cadcdb9555
3 changed files with 6 additions and 0 deletions
@@ -40,6 +40,7 @@ describe("SwiftShader launch environment", () => {
const saved = Object.fromEntries(Object.keys(PINS).map((name) => [name, process.env[name]]));
beforeEach(() => {
vi.stubEnv("PRODUCER_HEADLESS_SHELL_PATH", process.execPath);
vi.spyOn(console, "log").mockImplementation(() => {});
});
@@ -51,6 +52,7 @@ describe("SwiftShader launch environment", () => {
if (value === undefined) delete process.env[name];
else process.env[name] = value;
}
vi.unstubAllEnvs();
vi.restoreAllMocks();
});
@@ -47,6 +47,7 @@ describe("WSL GPU without WAYLAND_DISPLAY", () => {
beforeEach(() => {
process.env.WAYLAND_DISPLAY = "wayland-0";
vi.stubEnv("PRODUCER_HEADLESS_SHELL_PATH", process.execPath);
vi.spyOn(console, "error").mockImplementation(() => {});
vi.spyOn(console, "log").mockImplementation(() => {});
});
@@ -58,6 +59,7 @@ describe("WSL GPU without WAYLAND_DISPLAY", () => {
_setPuppeteerForTests(undefined);
if (savedWayland === undefined) delete process.env.WAYLAND_DISPLAY;
else process.env.WAYLAND_DISPLAY = savedWayland;
vi.unstubAllEnvs();
vi.restoreAllMocks();
});
@@ -1757,6 +1757,7 @@ describe("browser pool", () => {
let launchFn: ReturnType<typeof vi.fn>;
beforeEach(() => {
vi.stubEnv("PRODUCER_HEADLESS_SHELL_PATH", process.execPath);
_resetBrowserPoolForTests();
const mockBrowser = makeMockBrowser();
launchFn = vi.fn().mockResolvedValue(mockBrowser);
@@ -1766,6 +1767,7 @@ describe("browser pool", () => {
afterEach(async () => {
await drainBrowserPool();
_setPuppeteerForTests(undefined);
vi.unstubAllEnvs();
});
it.each([undefined, "1"])(