Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep resolving bundled Chromium past a workspace whose browser is missing (#12315)
[._.]/ Adam Eivy65bb728caca9
diff --git a/scripts/lib/testChrome.js b/scripts/lib/testChrome.jsindex 2508e2c194..e52367713f 100644--- a/scripts/lib/testChrome.js+++ b/scripts/lib/testChrome.js@@ -22,12 +22,22 @@ const TEST_CHROME_CANDIDATES = Object.freeze(['/usr/bin/chromium-browser',]);-/** Playwright's bundled Chromium, when playwright-core is installed and a browser was downloaded; null otherwise. */-export function bundledChromium(anchors = PLAYWRIGHT_RESOLVE_ROOTS) {+/**+ * Playwright's bundled Chromium, when playwright-core is installed and a browser was downloaded; null otherwise.+ * Keeps walking workspace anchors past an install whose browser is missing, so a+ * downloaded browser in a later workspace is still found. When none exists on disk,+ * returns the first resolved path (callers check existence themselves).+ */+export function bundledChromium(anchors = PLAYWRIGHT_RESOLVE_ROOTS, exists = existsSync) {+ let firstResolved = null;for (const anchor of anchors) {- try { return createRequire(anchor)('playwright-core').chromium.executablePath(); } catch { /* try the next workspace */ }+ let path;+ try { path = createRequire(anchor)('playwright-core').chromium.executablePath(); } catch { continue; }+ if (!path) continue;+ if (exists(path)) return path;+ firstResolved ??= path;}- return null;+ return firstResolved;}/**diff --git a/scripts/lib/testChrome.test.js b/scripts/lib/testChrome.test.jsindex ef8a9e4ebc..4e84171607 100644--- a/scripts/lib/testChrome.test.js+++ b/scripts/lib/testChrome.test.js@@ -1,6 +1,6 @@import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';-import { join } from 'node:path';+import { dirname, join } from 'node:path';import { afterEach, describe, expect, it } from 'vitest';import { bundledChromium } from './testChrome.js';@@ -32,4 +32,17 @@ describe('bundledChromium', () => {writeFileSync(join(empty, 'package.json'), '{}');expect(bundledChromium([join(empty, 'package.json')])).toBeNull();});++ it('skips an anchor whose Chromium executable is missing for a later one that has it', () => {+ const present = join(mkdtempSync(join(tmpdir(), 'testchrome-bin-')), 'chrome');+ dirs.push(dirname(present));+ writeFileSync(present, '');+ const missingFirst = workspaceWithPlaywright(join(dirname(present), 'absent-chrome'));+ expect(bundledChromium([missingFirst, workspaceWithPlaywright(present)])).toBe(present);+ });++ it('returns the first resolved path when no anchor executable exists', () => {+ const first = workspaceWithPlaywright('/nope/a');+ expect(bundledChromium([first, workspaceWithPlaywright('/nope/b')])).toBe('/nope/a');+ });});