Summary
DebuggerEndpointHelper has important endpoint selection and fallback logic, but it is currently covered only indirectly through reactNativeCDPProxy.test.ts. Direct unit tests would make regressions easier to catch without requiring a live CDP proxy server.
Why this is useful
The helper is used by both ReactNativeCDPProxy and direct debugging flows. It handles /json/version vs /json/list fallback, Hermes improved Chrome reload target selection, debugger type detection, retry behavior, and loopback HTTPS certificate handling. A small direct test suite can exercise these branches with stubbed HTTP/HTTPS/DNS dependencies.
Suggested scope
- Add direct tests for
src/cdp-proxy/debuggerEndpointHelper.ts.
- Cover
getWSEndpoint returning /json/version webSocketDebuggerUrl when present.
- Cover fallback to
/json/list, including the Hermes "React Native Experimental (Improved Chrome Reloads)" target selection.
- Cover fallback to the default Metro
http://localhost:8081/json/list endpoint when the requested browser URL has no targets.
- Cover
getDebuggerTpye returning expo vs react-native from title/description data.
- Cover retry/cancellation behavior in
retryGetWSEndpoint without waiting on real network services.
Evidence
test/cdp-proxy/reactNativeCDPProxy.test.ts calls new DebuggerEndpointHelper().getWSEndpoint(...), but only as part of proxy setup.
- There is no direct
debuggerEndpointHelper test file under test/cdp-proxy/.
src/cdp-proxy/debuggerEndpointHelper.ts contains multiple fallback/error branches that are not explicitly asserted.
Validation
npm test should include the new helper tests and pass.
- The tests should not require a real Metro server, device, or browser target.
Summary
DebuggerEndpointHelperhas important endpoint selection and fallback logic, but it is currently covered only indirectly throughreactNativeCDPProxy.test.ts. Direct unit tests would make regressions easier to catch without requiring a live CDP proxy server.Why this is useful
The helper is used by both
ReactNativeCDPProxyand direct debugging flows. It handles/json/versionvs/json/listfallback, Hermes improved Chrome reload target selection, debugger type detection, retry behavior, and loopback HTTPS certificate handling. A small direct test suite can exercise these branches with stubbed HTTP/HTTPS/DNS dependencies.Suggested scope
src/cdp-proxy/debuggerEndpointHelper.ts.getWSEndpointreturning/json/versionwebSocketDebuggerUrlwhen present./json/list, including the Hermes "React Native Experimental (Improved Chrome Reloads)" target selection.http://localhost:8081/json/listendpoint when the requested browser URL has no targets.getDebuggerTpyereturningexpovsreact-nativefrom title/description data.retryGetWSEndpointwithout waiting on real network services.Evidence
test/cdp-proxy/reactNativeCDPProxy.test.tscallsnew DebuggerEndpointHelper().getWSEndpoint(...), but only as part of proxy setup.debuggerEndpointHelpertest file undertest/cdp-proxy/.src/cdp-proxy/debuggerEndpointHelper.tscontains multiple fallback/error branches that are not explicitly asserted.Validation
npm testshould include the new helper tests and pass.