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: resolve playwright-core from the server and client workspaces in the test-Chrome resolver (#12315)
[._.]/ Adam Eivyea6f8b8ab675
diff --git a/scripts/lib/testChrome.js b/scripts/lib/testChrome.jsindex b6f64bc1a8..2508e2c194 100644--- a/scripts/lib/testChrome.js+++ b/scripts/lib/testChrome.js@@ -1,5 +1,11 @@import { existsSync } from 'node:fs';import { createRequire } from 'node:module';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';++const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');+// playwright-core is installed per workspace, so resolve from each workspace (and the root), not from scripts/lib.+const PLAYWRIGHT_RESOLVE_ROOTS = Object.freeze(['server', 'client', ''].map((dir) => join(REPO_ROOT, dir, 'package.json')));/*** Where the browser suites look for a Chrome after `CHROME_PATH` and@@ -17,8 +23,11 @@ const TEST_CHROME_CANDIDATES = Object.freeze([]);/** 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; }+export function bundledChromium(anchors = PLAYWRIGHT_RESOLVE_ROOTS) {+ for (const anchor of anchors) {+ try { return createRequire(anchor)('playwright-core').chromium.executablePath(); } catch { /* try the next workspace */ }+ }+ return null;}/**diff --git a/scripts/lib/testChrome.test.js b/scripts/lib/testChrome.test.jsnew file mode 100644index 0000000000..ef8a9e4ebc--- /dev/null+++ b/scripts/lib/testChrome.test.js@@ -0,0 +1,35 @@+import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { afterEach, describe, expect, it } from 'vitest';+import { bundledChromium } from './testChrome.js';++const dirs = [];+afterEach(() => { while (dirs.length) rmSync(dirs.pop(), { recursive: true, force: true }); });++function workspaceWithPlaywright(executable) {+ const dir = mkdtempSync(join(tmpdir(), 'testchrome-'));+ dirs.push(dir);+ const pkg = join(dir, 'node_modules', 'playwright-core');+ mkdirSync(pkg, { recursive: true });+ writeFileSync(join(pkg, 'package.json'), '{"name":"playwright-core","main":"index.js"}');+ writeFileSync(join(pkg, 'index.js'), `module.exports = { chromium: { executablePath: () => ${JSON.stringify(executable)} } };`);+ writeFileSync(join(dir, 'package.json'), '{}');+ return join(dir, 'package.json');+}++describe('bundledChromium', () => {+ it('finds playwright-core installed in a later workspace anchor', () => {+ const empty = mkdtempSync(join(tmpdir(), 'testchrome-empty-'));+ dirs.push(empty);+ writeFileSync(join(empty, 'package.json'), '{}');+ expect(bundledChromium([join(empty, 'package.json'), workspaceWithPlaywright('/x/chrome')])).toBe('/x/chrome');+ });++ it('returns null when no anchor resolves playwright-core', () => {+ const empty = mkdtempSync(join(tmpdir(), 'testchrome-empty-'));+ dirs.push(empty);+ writeFileSync(join(empty, 'package.json'), '{}');+ expect(bundledChromium([join(empty, 'package.json')])).toBeNull();+ });+});