Summary
StartLogCatMonitor has no dedicated unit tests. The command covers three meaningful code paths: no device found (shows error message), device found (stops any previous monitor and starts a new one), and LogCat start failure (logs a warning). Its counterpart StopLogCatMonitor already has comprehensive tests; adding tests here completes the LogCat monitor lifecycle coverage.
Why this is useful
A regression in target selection, monitor replacement, or error propagation would silently break the Android LogCat workflow. The current test suite guards StopLogCatMonitor but leaves the start path untested.
Suggested scope
- Add
test/extension/commands/startLogCatMonitor.test.ts using the proxyquire + sinon pattern from stopLogCatMonitor.test.ts.
- Stub
AndroidTargetManager, LogCatMonitorManager, LogCatMonitor, SettingsHelper, TipNotificationService, OutputChannelLogger, and vscode.window.showErrorMessage.
- Test:
selectAndPrepareTarget returns null → showErrorMessage called, monitor not started.
- Test:
selectAndPrepareTarget returns a target → delMonitor called for previous, new monitor created and start() invoked.
- Test:
logCatMonitor.start() rejects → warning logged, no error thrown from baseFn.
Evidence
Validation
- Run
npm run build.
- Run
npm test and confirm the new suite passes.
startLogCatMonitor scenarios: no-device, device-found, start-error.
Summary
StartLogCatMonitorhas no dedicated unit tests. The command covers three meaningful code paths: no device found (shows error message), device found (stops any previous monitor and starts a new one), and LogCat start failure (logs a warning). Its counterpartStopLogCatMonitoralready has comprehensive tests; adding tests here completes the LogCat monitor lifecycle coverage.Why this is useful
A regression in target selection, monitor replacement, or error propagation would silently break the Android LogCat workflow. The current test suite guards
StopLogCatMonitorbut leaves the start path untested.Suggested scope
test/extension/commands/startLogCatMonitor.test.tsusing theproxyquire+ sinon pattern fromstopLogCatMonitor.test.ts.AndroidTargetManager,LogCatMonitorManager,LogCatMonitor,SettingsHelper,TipNotificationService,OutputChannelLogger, andvscode.window.showErrorMessage.selectAndPrepareTargetreturnsnull→showErrorMessagecalled, monitor not started.selectAndPrepareTargetreturns a target →delMonitorcalled for previous, new monitor created andstart()invoked.logCatMonitor.start()rejects → warning logged, no error thrown frombaseFn.Evidence
src/extension/commands/startLogCatMonitor.ts— command with three distinct code paths, no matching test file.test/extension/commands/stopLogCatMonitor.test.ts— established pattern for LogCat monitor command tests.Validation
npm run build.npm testand confirm the new suite passes.startLogCatMonitorscenarios: no-device, device-found, start-error.