diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 21:48:35 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | 6d300099a86cfdb92b7869dc2b4f33094554b24c (patch) | |
| tree | 56ea6be73ac8b92d4ae4a2731e8d41dd54e876f7 /test/util/debug-test.ts | |
| parent | aedbb88a8025851067be9f77ec406b29d65599a8 (diff) | |
fix: make --browser-debug-clicks and BU_CDP_WS actually work
Both were documented and inert.
--browser-debug-clicks was registered as a flag and never read; the only
real switch was the undocumented BH_DEBUG_CLICKS env var. The flag now
feeds util/debug.ts, which the click tool consults, and the env var keeps
working as an equivalent.
BU_CDP_WS was read in the client and handed to transport.connect(), but
the daemon transport discards that argument and always dials the daemon
socket — and the daemon's own discovery never looked at the variable, so
setting it did nothing. The override now lives in discoverEndpoint, which
is what both processes go through, and the client's redundant read is
gone. The variable must be set before the daemon spawns.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'test/util/debug-test.ts')
| -rw-r--r-- | test/util/debug-test.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/util/debug-test.ts b/test/util/debug-test.ts new file mode 100644 index 0000000..08236dd --- /dev/null +++ b/test/util/debug-test.ts @@ -0,0 +1,32 @@ +import { test, describe, afterEach } from "node:test"; +import assert from "node:assert/strict"; +import { debugClicksEnabled, setDebugClicks } from "../../src/util/debug"; + +describe("debug click overlay switch", () => { + afterEach(() => { + setDebugClicks(false); + }); + + test("off when neither the flag nor the env var is set", () => { + assert.equal(debugClicksEnabled({}), false); + }); + + test("the --browser-debug-clicks flag turns it on", () => { + setDebugClicks(true); + assert.equal(debugClicksEnabled({}), true); + }); + + test("BH_DEBUG_CLICKS still turns it on without the flag", () => { + assert.equal(debugClicksEnabled({ BH_DEBUG_CLICKS: "1" }), true); + }); + + test("an empty BH_DEBUG_CLICKS does not turn it on", () => { + assert.equal(debugClicksEnabled({ BH_DEBUG_CLICKS: "" }), false); + }); + + test("the flag can be turned back off", () => { + setDebugClicks(true); + setDebugClicks(false); + assert.equal(debugClicksEnabled({}), false); + }); +}); |
