@@ -241,9 +241,10 @@ suite('Terminal Service', () => {
241241 terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
242242
243243 await service . ensureTerminal ( ) ;
244- // Simulate REPL ready by firing the >>> prompt
244+ // Start executeCommand (sets up listener), then fire >>> prompt, then await
245+ const executePromise = service . executeCommand ( textToSend , true ) ;
245246 onDidWriteTerminalDataEmitter . fire ( { terminal : terminal . object , data : '>>> ' } ) ;
246- await service . executeCommand ( textToSend , true ) ;
247+ await executePromise ;
247248
248249 terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . atLeastOnce ( ) ) ;
249250 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
@@ -264,9 +265,10 @@ suite('Terminal Service', () => {
264265 terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
265266
266267 await service . ensureTerminal ( ) ;
267- // Simulate REPL ready by firing the >>> prompt
268+ // Start executeCommand (sets up listener), then fire >>> prompt, then await
269+ const executePromise = service . executeCommand ( textToSend , true ) ;
268270 onDidWriteTerminalDataEmitter . fire ( { terminal : terminal . object , data : '>>> ' } ) ;
269- await service . executeCommand ( textToSend , true ) ;
271+ await executePromise ;
270272
271273 terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . atLeastOnce ( ) ) ;
272274 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
@@ -288,9 +290,10 @@ suite('Terminal Service', () => {
288290 terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
289291
290292 await service . ensureTerminal ( ) ;
291- // Simulate REPL ready by firing the >>> prompt
293+ // Start executeCommand (sets up listener), then fire >>> prompt, then await
294+ const executePromise = service . executeCommand ( textToSend , true ) ;
292295 onDidWriteTerminalDataEmitter . fire ( { terminal : terminal . object , data : '>>> ' } ) ;
293- await service . executeCommand ( textToSend , true ) ;
296+ await executePromise ;
294297
295298 terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . atLeastOnce ( ) ) ;
296299 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
@@ -321,9 +324,10 @@ suite('Terminal Service', () => {
321324 terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
322325
323326 await service . ensureTerminal ( ) ;
324- // Simulate REPL ready by firing the >>> prompt
327+ // Start executeCommand (sets up listener), then fire >>> prompt, then await
328+ const executePromise = service . executeCommand ( textToSend , true ) ;
325329 onDidWriteTerminalDataEmitter . fire ( { terminal : terminal . object , data : '>>> ' } ) ;
326- await service . executeCommand ( textToSend , true ) ;
330+ await executePromise ;
327331
328332 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . once ( ) ) ;
329333 } ) ;
@@ -344,9 +348,10 @@ suite('Terminal Service', () => {
344348 terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
345349
346350 await service . ensureTerminal ( ) ;
347- // Simulate REPL ready by firing the >>> prompt
351+ // Start executeCommand (sets up listener), then fire >>> prompt, then await
352+ const executePromise = service . executeCommand ( textToSend , true ) ;
348353 onDidWriteTerminalDataEmitter . fire ( { terminal : terminal . object , data : '>>> ' } ) ;
349- await service . executeCommand ( textToSend , true ) ;
354+ await executePromise ;
350355
351356 terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . atLeastOnce ( ) ) ;
352357 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
0 commit comments