@@ -60,6 +60,12 @@ suite('CommandDetectionCapability', () => {
60
60
capability . handleCommandFinished ( exitCode ) ;
61
61
}
62
62
63
+ async function printCommandStart ( prompt : string ) {
64
+ capability . handlePromptStart ( ) ;
65
+ await writeP ( xterm , `\r${ prompt } ` ) ;
66
+ }
67
+
68
+
63
69
setup ( async ( ) => {
64
70
disposables = new DisposableStore ( ) ;
65
71
const TerminalCtor = ( await importAMDNodeModule < typeof import ( '@xterm/xterm' ) > ( '@xterm/xterm' , 'lib/xterm.js' ) ) . Terminal ;
@@ -86,6 +92,7 @@ suite('CommandDetectionCapability', () => {
86
92
87
93
test ( 'should add commands for expected capability method calls' , async ( ) => {
88
94
await printStandardCommand ( '$ ' , 'echo foo' , 'foo' , undefined , 0 ) ;
95
+ await printCommandStart ( '$ ' ) ;
89
96
assertCommands ( [ {
90
97
command : 'echo foo' ,
91
98
exitCode : 0 ,
@@ -96,6 +103,7 @@ suite('CommandDetectionCapability', () => {
96
103
97
104
test ( 'should trim the command when command executed appears on the following line' , async ( ) => {
98
105
await printStandardCommand ( '$ ' , 'echo foo\r\n' , 'foo' , undefined , 0 ) ;
106
+ await printCommandStart ( '$ ' ) ;
99
107
assertCommands ( [ {
100
108
command : 'echo foo' ,
101
109
exitCode : 0 ,
@@ -108,6 +116,7 @@ suite('CommandDetectionCapability', () => {
108
116
test ( 'should add cwd to commands when it\'s set' , async ( ) => {
109
117
await printStandardCommand ( '$ ' , 'echo foo' , 'foo' , '/home' , 0 ) ;
110
118
await printStandardCommand ( '$ ' , 'echo bar' , 'bar' , '/home/second' , 0 ) ;
119
+ await printCommandStart ( '$ ' ) ;
111
120
assertCommands ( [
112
121
{ command : 'echo foo' , exitCode : 0 , cwd : '/home' , marker : { line : 0 } } ,
113
122
{ command : 'echo bar' , exitCode : 0 , cwd : '/home/second' , marker : { line : 2 } }
@@ -116,6 +125,7 @@ suite('CommandDetectionCapability', () => {
116
125
test ( 'should add old cwd to commands if no cwd sequence is output' , async ( ) => {
117
126
await printStandardCommand ( '$ ' , 'echo foo' , 'foo' , '/home' , 0 ) ;
118
127
await printStandardCommand ( '$ ' , 'echo bar' , 'bar' , undefined , 0 ) ;
128
+ await printCommandStart ( '$ ' ) ;
119
129
assertCommands ( [
120
130
{ command : 'echo foo' , exitCode : 0 , cwd : '/home' , marker : { line : 0 } } ,
121
131
{ command : 'echo bar' , exitCode : 0 , cwd : '/home' , marker : { line : 2 } }
@@ -124,6 +134,7 @@ suite('CommandDetectionCapability', () => {
124
134
test ( 'should use an undefined cwd if it\'s not set initially' , async ( ) => {
125
135
await printStandardCommand ( '$ ' , 'echo foo' , 'foo' , undefined , 0 ) ;
126
136
await printStandardCommand ( '$ ' , 'echo bar' , 'bar' , '/home' , 0 ) ;
137
+ await printCommandStart ( '$ ' ) ;
127
138
assertCommands ( [
128
139
{ command : 'echo foo' , exitCode : 0 , cwd : undefined , marker : { line : 0 } } ,
129
140
{ command : 'echo bar' , exitCode : 0 , cwd : '/home' , marker : { line : 2 } }
0 commit comments