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
refactor: move the test-Chrome resolver to scripts/lib so client suites can share it (#12315)
[._.]/ Adam Eivy03ef1c632971
diff --git a/client/src/components/CmdKSearch.browser.test.js b/client/src/components/CmdKSearch.browser.test.jsindex f25b54c5d1..0238941c19 100644--- a/client/src/components/CmdKSearch.browser.test.js+++ b/client/src/components/CmdKSearch.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);// Prefer the client dev dependency; linked worktrees can also use the samediff --git a/client/src/components/Drawer.browser.test.js b/client/src/components/Drawer.browser.test.jsindex 6cff630aa3..dda3ee9021 100644--- a/client/src/components/Drawer.browser.test.js+++ b/client/src/components/Drawer.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { chromium } from 'playwright-core';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const auditCdp = process.env.PORTOS_AUDIT_CDP;const chrome = resolveTestChrome();diff --git a/client/src/components/ProviderModelSelector.browser.test.js b/client/src/components/ProviderModelSelector.browser.test.jsindex 01ea18e46d..71044ee034 100644--- a/client/src/components/ProviderModelSelector.browser.test.js+++ b/client/src/components/ProviderModelSelector.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { chromium } from 'playwright-core';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const chrome = resolveTestChrome();diff --git a/client/src/components/ThemeSwitcher.browser.test.js b/client/src/components/ThemeSwitcher.browser.test.jsindex 64a33242bf..b38d757db2 100644--- a/client/src/components/ThemeSwitcher.browser.test.js+++ b/client/src/components/ThemeSwitcher.browser.test.js@@ -7,7 +7,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';import { THEME_IDS } from '../themes/portosThemes.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);const { chromium } = require(require.resolve('playwright-core', { paths: [diff --git a/client/src/components/brain/tabs/InboxTab.browser.test.js b/client/src/components/brain/tabs/InboxTab.browser.test.jsindex 8a8f31a3b6..f1931f5178 100644--- a/client/src/components/brain/tabs/InboxTab.browser.test.js+++ b/client/src/components/brain/tabs/InboxTab.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../../scripts/lib/testChrome.js';// Browser startup/navigation is bounded separately from 5s interactions.vi.setConfig({ testTimeout: 30000 });diff --git a/client/src/components/cos/tabs/RunsTab.browser.test.js b/client/src/components/cos/tabs/RunsTab.browser.test.jsindex 2145f7e4ec..da346dbb64 100644--- a/client/src/components/cos/tabs/RunsTab.browser.test.js+++ b/client/src/components/cos/tabs/RunsTab.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { chromium } from 'playwright-core';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../../scripts/lib/testChrome.js';const auditCdp = process.env.PORTOS_AUDIT_CDP;const chrome = resolveTestChrome();diff --git a/client/src/components/goals/GoalsOrganization.browser.test.js b/client/src/components/goals/GoalsOrganization.browser.test.jsindex 30e7d92d29..15a659a616 100644--- a/client/src/components/goals/GoalsOrganization.browser.test.js+++ b/client/src/components/goals/GoalsOrganization.browser.test.js@@ -7,7 +7,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../test/browserFixture.js';import { ASYNC_UTIL_TIMEOUT_MS } from '../../test/timeouts.js';-import { resolveTestChrome } from '../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);const { chromium } = require('playwright-core');diff --git a/client/src/components/goals/GoalsTreeView.browser.test.js b/client/src/components/goals/GoalsTreeView.browser.test.jsindex 4f4ce1a7e9..7efda159fa 100644--- a/client/src/components/goals/GoalsTreeView.browser.test.js+++ b/client/src/components/goals/GoalsTreeView.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);// Prefer the client dev dependency; linked worktrees can also use the samediff --git a/client/src/components/media/MediaLightbox.browser.test.js b/client/src/components/media/MediaLightbox.browser.test.jsindex b718556043..bc120e35d1 100644--- a/client/src/components/media/MediaLightbox.browser.test.js+++ b/client/src/components/media/MediaLightbox.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);const { chromium } = require(require.resolve('playwright-core', { paths: [diff --git a/client/src/components/ui/InfoTooltip.browser.test.js b/client/src/components/ui/InfoTooltip.browser.test.jsindex 09dca3497f..a11354e297 100644--- a/client/src/components/ui/InfoTooltip.browser.test.js+++ b/client/src/components/ui/InfoTooltip.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);const { chromium } = require(require.resolve('playwright-core', { paths: [diff --git a/client/src/components/ui/OverflowMenu.browser.test.js b/client/src/components/ui/OverflowMenu.browser.test.jsindex 8844ff242a..5db61ff9f1 100644--- a/client/src/components/ui/OverflowMenu.browser.test.js+++ b/client/src/components/ui/OverflowMenu.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../../test/browserFixture.js';-import { resolveTestChrome } from '../../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../../scripts/lib/testChrome.js';const require = createRequire(import.meta.url);// Prefer the client dev dependency; linked worktrees can also use the samediff --git a/client/src/pages/Loras.browser.test.js b/client/src/pages/Loras.browser.test.jsindex 8dd58c3998..ae23992137 100644--- a/client/src/pages/Loras.browser.test.js+++ b/client/src/pages/Loras.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { chromium } from 'playwright-core';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const chrome = resolveTestChrome();diff --git a/client/src/pages/PromptManager.browser.test.js b/client/src/pages/PromptManager.browser.test.jsindex b359e77630..b3cc8d6279 100644--- a/client/src/pages/PromptManager.browser.test.js+++ b/client/src/pages/PromptManager.browser.test.js@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';vi.setConfig({ testTimeout: 30000 });diff --git a/client/src/pages/Shell.browser.test.js b/client/src/pages/Shell.browser.test.jsindex ba1014d100..44de918c13 100644--- a/client/src/pages/Shell.browser.test.js+++ b/client/src/pages/Shell.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';import { chromium } from 'playwright-core';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const chrome = resolveTestChrome();diff --git a/client/src/pages/StoryBuilder.browser.test.js b/client/src/pages/StoryBuilder.browser.test.jsindex 3cc77d5322..3750e7e773 100644--- a/client/src/pages/StoryBuilder.browser.test.js+++ b/client/src/pages/StoryBuilder.browser.test.js@@ -6,7 +6,7 @@ import { createServer } from 'vite';import react from '@vitejs/plugin-react';import { chromium } from 'playwright-core';import { BROWSER_FIXTURE_STARTUP_MS, startBrowserFixture } from '../test/browserFixture.js';-import { resolveTestChrome } from '../../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from '../../../scripts/lib/testChrome.js';const chrome = resolveTestChrome();const steps = ['idea', 'universeAesthetic', 'plotArc', 'readerMap', 'characters', 'issues', 'production']diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.mdindex 8e406807d9..af8daff830 100644--- a/docs/GITHUB_ACTIONS.md+++ b/docs/GITHUB_ACTIONS.md@@ -926,7 +926,7 @@ version of an external program a member reaches (`TEST_MEMO_TOOLS`: thepython the sidecar tests spawn — a literal, `PORTOS_TEST_PYTHON`, or aninterpreter bound from `resolveTestPython()`; ffmpeg/ffprobe; and Chrome forthe browser suites, found with the suites' own candidate list,-`resolveTestChrome` in `server/lib/browserSuiteGate.js`); an unknown program+`resolveTestChrome` in `scripts/lib/testChrome.js`); an unknown programhanded a `.py` file fails closed; the workspace Vitest config closure, setup files,`scripts/vitestCiPool.js`, `package.json` and lockfile; the full Nodeversion, `process.platform`, `process.arch`; and `TEST_MEMO_ENV` (`CI`,diff --git a/scripts/browser-fidelity.js b/scripts/browser-fidelity.jsindex 202f7fd4eb..6fb6495531 100644--- a/scripts/browser-fidelity.js+++ b/scripts/browser-fidelity.js@@ -41,7 +41,8 @@ export function fidelityChildEnv(env, diagnostics) {async function fidelityToolchain(env) {const { findFfmpeg } = await import('../server/lib/ffmpeg.js');const { _testChromeCaptureArgs } = await import('../server/services/htmlComposition/testBrowserCleanup.js');- const { resolveTestChrome, probeChromeH264, describeH264Probe } = await import('../server/lib/browserSuiteGate.js');+ const { resolveTestChrome } = await import('./lib/testChrome.js');+ const { probeChromeH264, describeH264Probe } = await import('../server/lib/browserSuiteGate.js');const chromePath = resolveTestChrome(env);const ffmpegPath = await findFfmpeg();if (!chromePath || !ffmpegPath) throw Error('Fidelity Chrome/FFmpeg toolchain unavailable.');diff --git a/scripts/ci-warm-test-chrome.sh b/scripts/ci-warm-test-chrome.shindex 469e20c79a..df1e706ed3 100755--- a/scripts/ci-warm-test-chrome.sh+++ b/scripts/ci-warm-test-chrome.sh@@ -22,14 +22,14 @@set -uo pipefailBUDGET="${CHROME_WARM_BUDGET_SECONDS:-90}"-# The default list is resolveTestChrome's (server/lib/browserSuiteGate.js), the one+# The default list is resolveTestChrome's (scripts/lib/testChrome.js), the one# resolver the suites, pregate and test memo share (#12315): this asks it for the# Chrome a suite would launch rather than keeping a shell copy of the paths.if [ -n "${CHROME_WARM_CANDIDATES+x}" ]; thenread -r -a CANDIDATES <<< "$CHROME_WARM_CANDIDATES"elseROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"- CANDIDATES=("$(node -e "import(require('url').pathToFileURL(process.argv[1])).then((m) => process.stdout.write(m.resolveTestChrome() ?? ''))" "$ROOT/server/lib/browserSuiteGate.js" 2>/dev/null)")+ CANDIDATES=("$(node -e "import(require('url').pathToFileURL(process.argv[1])).then((m) => process.stdout.write(m.resolveTestChrome() ?? ''))" "$ROOT/scripts/lib/testChrome.js" 2>/dev/null)")fi# Never replace the wall-clock budget with an unbounded read. GNU coreutilsdiff --git a/scripts/lib/pregateResources.js b/scripts/lib/pregateResources.jsindex 4ca624df74..c723c8c5dc 100644--- a/scripts/lib/pregateResources.js+++ b/scripts/lib/pregateResources.js@@ -14,7 +14,8 @@ import { join } from 'node:path';import databaseSettings from './databaseSettings.cjs';import { parseEnvFile } from './envFile.js';import { findFfmpeg } from '../../server/lib/ffmpeg.js';-import { browserSuiteBlockReason, chromeWithH264, resolveTestChrome } from '../../server/lib/browserSuiteGate.js';+import { browserSuiteBlockReason, chromeWithH264 } from '../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from './testChrome.js';/** The only database the DB stage may target; `server/lib/db.js` refuses the rest. */export const TEST_DATABASE = 'portos_test';diff --git a/scripts/lib/testChrome.js b/scripts/lib/testChrome.jsnew file mode 100644index 0000000000..b6f64bc1a8--- /dev/null+++ b/scripts/lib/testChrome.js@@ -0,0 +1,31 @@+import { existsSync } from 'node:fs';+import { createRequire } from 'node:module';++/**+ * Where the browser suites look for a Chrome after `CHROME_PATH` and+ * Playwright's bundled Chromium: the macOS app and the Linux package paths.+ * One list for the client and server suites, the pregate probe, the test memo+ * and `scripts/ci-warm-test-chrome.sh` (#12293, #12315). It lives outside+ * `server/lib` so client tests can import it without tripping the+ * browser-safe-imports guard on that tree.+ */+const TEST_CHROME_CANDIDATES = Object.freeze([+ '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',+ '/usr/bin/google-chrome',+ '/usr/bin/chromium',+ '/usr/bin/chromium-browser',+]);++/** Playwright's bundled Chromium, when playwright-core is installed and a browser was downloaded; null otherwise. */+function bundledChromium() {+ try { return createRequire(import.meta.url)('playwright-core').chromium.executablePath(); } catch { return null; }+}++/**+ * The Chrome binary a browser suite would launch on this machine, or null:+ * `env.CHROME_PATH`, then Playwright's bundled Chromium, then the macOS app+ * and the Linux package paths, the first that exists.+ */+export function resolveTestChrome(env = process.env, { exists = existsSync, bundled = bundledChromium } = {}) {+ return [env.CHROME_PATH, bundled(), ...TEST_CHROME_CANDIDATES].find((path) => path && exists(path)) ?? null;+}diff --git a/scripts/lib/testMemoRunner.js b/scripts/lib/testMemoRunner.jsindex 2301ec04a2..e44e49429b 100644--- a/scripts/lib/testMemoRunner.js+++ b/scripts/lib/testMemoRunner.js@@ -31,7 +31,7 @@ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import * as nodePath from 'node:path';import { join, relative, sep } from 'node:path';-import { resolveTestChrome } from '../../server/lib/browserSuiteGate.js';+import { resolveTestChrome } from './testChrome.js';import { WORKSPACE_BASE_INPUTS, createDiskFs, createTestMemoAnalyzer, relatedTests } from './testMemo.js';import { readMemoEntry, readMemoRecord, writeMemoEntry, writeMemoRecord } from './testMemoStore.js';import { listWorkspaceTests, toRepoPath, toWorkspacePath } from './workspaceTests.js';diff --git a/server/lib/README.md b/server/lib/README.mdindex f9905aafa3..389a39366e 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -777,7 +777,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| Module | Purpose ||---|---|-| `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying (#12293). |+| `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` (re-exported from `scripts/lib/testChrome.js`, where client tests import it too) is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying (#12293). || `dbTestGate.js` | `requireDbOrSkip(label, dbReady, reason)` keeps a missing local test database as a visible skipped suite, but throws when `PORTOS_REQUIRE_DB` is set so CI cannot pass after DB-backed suites disappear. || `gitTestRepo.js` | Shared real-git sandbox for integration tests (#4394): one initialized template (working tree + bare origin) per worker, then `fs.cp` into a fresh temp dir. `makeGitSandbox({ origin })`, `attachBareOrigin(scratch, repo)`, `materializeGitRepo(dest)`, `destroyGitSandbox`, plus `SKIP_HEAVY_INTEGRATION` (`VITEST_FAST=1`). `resetGitSandbox({ scratch, repo, initialHead })` / `resetGitWorktreeSandbox(repo, initialHead)` restore a sandbox in place (branches, worktrees, remote) so a `describe` can build one sandbox in `beforeAll` and reset between tests instead of paying the fs.cp/rm cycle per test (#5902). Every entry point runs `assertTempPath` first, so a path outside `os.tmpdir()` throws instead of `git init`-ing or `rm -rf`-ing a real checkout (#4554). Fixture-local maintenance/GC detachment is disabled so awaited Git operations retain their writers through teardown. Still real git — just not rebuilt from `init`+`commit`+`push` in every `beforeEach`. || `mirrorParity.js` | Source-extraction and comparison primitives for declaration-level contract tests: the vendored `aiToolkit/` copy of `TOOL_USE_RE` (`localModelHeuristics.mirror.test.js`), and the bootstrap sequence's body assertions (`bootstrap*.test.js`). A pure module the browser needs is imported by the client rather than mirrored, so no client↔server copy test should need these: `stripCommentsAndNormalize` (so per-side commentary may diverge but logic may not), `extractDeclaration(src, name)` (balanced `{}`/`()`/`[]` walk over `function` / `async function` / `const`), and `compareDeclaration(serverSrc, clientSrc, name)`. Use these instead of hand-rolling a brace-walker per mirror. Pure — no `vitest` import — so callers own the assertions. |diff --git a/server/lib/browserSuiteGate.js b/server/lib/browserSuiteGate.jsindex 877e0a64b7..8617bd0852 100644--- a/server/lib/browserSuiteGate.js+++ b/server/lib/browserSuiteGate.js@@ -1,34 +1,10 @@import { spawn } from './childProcess.js';-import { existsSync, mkdtempSync, rmSync } from 'node:fs';-import { createRequire } from 'node:module';+import { mkdtempSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';-/**- * Where the browser suites look for a Chrome after `CHROME_PATH` and- * Playwright's bundled Chromium: the macOS app and the Linux package paths.- * One list for the suites, the pregate probe and the test memo (#12293).- */-const TEST_CHROME_CANDIDATES = Object.freeze([- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',- '/usr/bin/google-chrome',- '/usr/bin/chromium',- '/usr/bin/chromium-browser',-]);--/** Playwright's bundled Chromium, when playwright-core is installed and a browser was downloaded; null otherwise. */-function bundledChromium() {- try { return createRequire(import.meta.url)('playwright-core').chromium.executablePath(); } catch { return null; }-}--/**- * The Chrome binary a browser suite would launch on this machine, or null:- * `env.CHROME_PATH`, then Playwright's bundled Chromium, then the macOS app- * and the Linux package paths, the first that exists.- */-export function resolveTestChrome(env = process.env, { exists = existsSync, bundled = bundledChromium } = {}) {- return [env.CHROME_PATH, bundled(), ...TEST_CHROME_CANDIDATES].find((path) => path && exists(path)) ?? null;-}+// The one Chrome resolver lives in scripts/lib so client tests can share it (#12315).+export { resolveTestChrome } from '../../scripts/lib/testChrome.js';/*** Keep cross-workspace browser suites as visible skips on machines without