@@ -1409,6 +1409,33 @@ describe("ClineProvider", () => {
14091409 expect ( vscode . commands . executeCommand ) . not . toHaveBeenCalledWith ( "workbench.action.reloadWindow" )
14101410 } )
14111411
1412+ test ( "offers a fresh actionable warning when one heartbeat is followed by another stall" , async ( ) => {
1413+ await provider . resolveWebviewView ( mockWebviewView )
1414+ vi . mocked ( vscode . commands . getCommands ) . mockResolvedValue ( [ ] )
1415+ let chooseOld : ( value : string ) => void = ( ) => {
1416+ throw new Error ( "Notification not shown" )
1417+ }
1418+ const oldChoice = new Promise < string > ( ( resolve ) => {
1419+ chooseOld = resolve
1420+ } )
1421+ vi . mocked ( vscode . window . showWarningMessage ) . mockImplementationOnce ( vi . fn ( ) . mockReturnValue ( oldChoice ) )
1422+ await vi . advanceTimersByTimeAsync ( 130_000 )
1423+ expect ( vscode . window . showWarningMessage ) . toHaveBeenCalledTimes ( 1 )
1424+
1425+ provider . updateWebviewHeartbeat ( )
1426+ expect ( provider [ "webviewRecoveryAttempts" ] ) . toBe ( 3 )
1427+ chooseOld ( "Reload Window" )
1428+ await vi . advanceTimersByTimeAsync ( 0 )
1429+ expect ( vscode . commands . executeCommand ) . not . toHaveBeenCalledWith ( "workbench.action.reloadWindow" )
1430+
1431+ vi . mocked ( vscode . window . showWarningMessage ) . mockImplementation ( vi . fn ( ) . mockResolvedValue ( "Reload Window" ) )
1432+ await vi . advanceTimersByTimeAsync ( 170_000 )
1433+ expect ( vscode . window . showWarningMessage ) . toHaveBeenCalledTimes ( 2 )
1434+ expect ( vscode . commands . executeCommand ) . toHaveBeenCalledWith ( "workbench.action.reloadWindow" )
1435+ await vi . advanceTimersByTimeAsync ( 240_000 )
1436+ expect ( vscode . window . showWarningMessage ) . toHaveBeenCalledTimes ( 2 )
1437+ } )
1438+
14121439 test ( "keeps the Reload Window action available after visibility grace resets" , async ( ) => {
14131440 await provider . resolveWebviewView ( mockWebviewView )
14141441 vi . mocked ( vscode . commands . getCommands ) . mockResolvedValue ( [ ] )
@@ -2304,7 +2331,7 @@ describe("ClineProvider", () => {
23042331 // Pin the health-check URL itself: the mock resolves for any URL, so only
23052332 // this assertion keeps the probe from silently drifting back to
23062333 // `localhost` (the IPv6 resolution failure this branch fixes).
2307- expect ( axios . get ) . toHaveBeenCalledWith ( "http://127.0.0.1:5173" )
2334+ expect ( axios . get ) . toHaveBeenCalledWith ( "http://127.0.0.1:5173" , { timeout : 5_000 } )
23082335
23092336 const html = mockWebviewView . webview . html
23102337 // The dev server URL must be baked into the module script tag and CSP directives.
0 commit comments