From 34e5cfdcbe29bbb5f2f46ba54eb67903abd9274d Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 20:32:57 +0530 Subject: refactor(test): strip comment noise Removes suite banners, section dividers, and test-id markers that restate the test names. Keeps one-line notes for the deleted-binary fixture order, the never-arriving event consumer, the absent-vs-undefined key distinction, the unexpected-method-echo rationale, and the real-browser teardown and Local State flush quirks. Co-Authored-By: Claude Opus 5 (1M context) --- test/profile/browser-process-test.ts | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'test/profile/browser-process-test.ts') diff --git a/test/profile/browser-process-test.ts b/test/profile/browser-process-test.ts index 7a86c74..efcb9c8 100644 --- a/test/profile/browser-process-test.ts +++ b/test/profile/browser-process-test.ts @@ -1,14 +1,3 @@ -/** - * Unit tests for browser-process parsing and candidate ranking — no browser. - * - * Ranking exists because a machine can run several Chromium browsers at once. - * Picking the wrong one means launching a profile window into a browser the - * harness is not connected to: the agent sees nothing, and a browser the user - * never pointed us at gets a new window. (That is exactly what happened during - * development before ranking existed.) - * - * Run: npm test - */ import { test, before, after, describe } from "node:test"; import assert from "node:assert/strict"; import { chmodSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; @@ -23,7 +12,6 @@ import { } from "../../src/profile/browser-process"; describe("browser-process parsing and candidate ranking", () => { - // B1: --user-data-dir parsing test("B1: bare value parsed", () => { assert.equal(parseUserDataDirFlag("/opt/google/chrome/chrome --user-data-dir=/tmp/x --foo"), "/tmp/x"); }); @@ -47,7 +35,6 @@ describe("browser-process parsing and candidate ranking", () => { assert.equal(parseUserDataDirFlag("chrome --user-data-dir="), undefined); }); - // B2: an explicit --user-data-dir is decisive in both directions test("B2: exact user-data-dir match outranks a flagless process", () => { const target = "/tmp/pi-e2e-abc"; const match = rankBrowserCandidate({ exePath: "/opt/google/chrome/chrome", explicitUserDataDir: target }, target); @@ -74,7 +61,6 @@ describe("browser-process parsing and candidate ranking", () => { assert.equal(other, 0); }); - // B3: browser family match decides between flagless processes test("B3: Brave wins for a Brave user-data-dir", () => { const braveDir = join(homedir(), ".config/BraveSoftware/Brave-Browser"); const brave = rankBrowserCandidate({ exePath: "/usr/bin/brave-browser" }, braveDir); @@ -98,7 +84,6 @@ describe("browser-process parsing and candidate ranking", () => { ); }); - // B4: no preference expressed → every candidate is equally acceptable test("B4: without a target dir, candidates rank equally", () => { assert.equal( rankBrowserCandidate({ exePath: "/usr/bin/brave-browser" }), @@ -106,7 +91,6 @@ describe("browser-process parsing and candidate ranking", () => { ); }); - // B5: Windows path comparison ignores case and separator style test("B5 win: case and separator differences still match", { skip: process.platform !== "win32" }, () => { assert.equal( rankBrowserCandidate( @@ -120,9 +104,6 @@ describe("browser-process parsing and candidate ranking", () => { ); }); - // B6: Linux's deleted-binary marker. An in-place `google-chrome` upgrade - // unlinks the running binary, after which /proc//exe reads - // "…/chrome (deleted)" — a path spawn() rejects with ENOENT. test("B6: marker stripped from a replaced binary's path", () => { assert.equal(stripDeletedSuffix("/opt/google/chrome/chrome (deleted)"), "/opt/google/chrome/chrome"); }); @@ -135,7 +116,6 @@ describe("browser-process parsing and candidate ranking", () => { assert.equal(stripDeletedSuffix(" (deleted)"), undefined); }); - // B7: only a path that is actually on disk may be handed on as spawnable. describe("B7", () => { let root: string; let real: string; @@ -168,9 +148,6 @@ describe("browser-process parsing and candidate ranking", () => { assert.equal(await spawnableExePath(""), undefined); }); - // The launch gate must never pass on a path it cannot spawn — that is - // what produced a 15s "couldn't open a window" timeout instead of a - // named error. test("B7: resolveBrowserExecutable repairs a replaced-binary path", async () => { assert.equal(await resolveBrowserExecutable({ running: true, exePath: `${real} (deleted)` }), real); }); @@ -183,8 +160,7 @@ describe("browser-process parsing and candidate ranking", () => { }, ); - // A binary genuinely named "… (deleted)" must win over the stripped form. - // Created last, so the checks above see only the ordinary case. + // A binary genuinely named "… (deleted)" must win over the stripped form; created last so the checks above see only the ordinary case. test("B7: a real file named '… (deleted)' is preferred over stripping", async () => { literal = join(root, "chrome (deleted)"); writeFileSync(literal, "#!/bin/sh\n"); -- cgit v1.2.3