44 *--------------------------------------------------------------------------------------------*/
55
66import { window , Pseudoterminal , EventEmitter , TerminalDimensions , workspace , ConfigurationTarget , Disposable , UIKind , env , EnvironmentVariableMutatorType , EnvironmentVariableMutator , extensions , ExtensionContext , TerminalOptions , ExtensionTerminalOptions , Terminal } from 'vscode' ;
7- import { doesNotThrow , equal , deepEqual , throws } from 'assert' ;
7+ import { doesNotThrow , equal , deepEqual , throws , strictEqual } from 'assert' ;
88import { assertNoRpc } from '../utils' ;
99
1010// Disable terminal tests:
@@ -19,8 +19,6 @@ import { assertNoRpc } from '../utils';
1919 extensionContext = ( global as any ) . testExtensionContext ;
2020
2121 const config = workspace . getConfiguration ( 'terminal.integrated' ) ;
22- // Disable conpty in integration tests because of https://github.com/microsoft/vscode/issues/76548
23- await config . update ( 'windowsEnableConpty' , false , ConfigurationTarget . Global ) ;
2422 // Disable exit alerts as tests may trigger then and we're not testing the notifications
2523 await config . update ( 'showExitAlert' , false , ConfigurationTarget . Global ) ;
2624 // Canvas may cause problems when running in a container
@@ -57,49 +55,43 @@ import { assertNoRpc } from '../utils';
5755 } ) ;
5856 } ) ;
5957
60- ( process . platform === 'linux' ? test . skip : test ) ( 'echo works in the default shell' , ( done ) => {
61- disposables . push ( window . onDidOpenTerminal ( term => {
62- try {
63- equal ( terminal , term ) ;
64- } catch ( e ) {
65- done ( e ) ;
66- return ;
67- }
68- let data = '' ;
69- const dataDisposable = window . onDidWriteTerminalData ( e => {
70- try {
71- equal ( terminal , e . terminal ) ;
72- } catch ( e ) {
73- done ( e ) ;
74- return ;
75- }
76- data += e . data ;
77- if ( data . indexOf ( expected ) !== 0 ) {
78- dataDisposable . dispose ( ) ;
79- terminal . dispose ( ) ;
80- disposables . push ( window . onDidCloseTerminal ( ( ) => {
81- done ( ) ;
82- } ) ) ;
83- }
58+ test ( 'echo works in the default shell' , async ( ) => {
59+ const terminal = await new Promise < Terminal > ( r => {
60+ disposables . push ( window . onDidOpenTerminal ( t => {
61+ strictEqual ( terminal , t ) ;
62+ r ( terminal ) ;
63+ } ) ) ;
64+ // Use a single character to avoid winpty/conpty issues with injected sequences
65+ const terminal = window . createTerminal ( {
66+ env : { TEST : '`' }
8467 } ) ;
85- disposables . push ( dataDisposable ) ;
86- } ) ) ;
87- // Use a single character to avoid winpty/conpty issues with injected sequences
88- const expected = '`' ;
89- const terminal = window . createTerminal ( {
90- env : {
91- TEST : '`'
92- }
68+ terminal . show ( ) ;
9369 } ) ;
94- terminal . show ( ) ;
95- doesNotThrow ( ( ) => {
70+
71+ let data = '' ;
72+ await new Promise < void > ( r => {
73+ disposables . push ( window . onDidWriteTerminalData ( e => {
74+ strictEqual ( terminal , e . terminal ) ;
75+ data += e . data ;
76+ if ( data . indexOf ( '`' ) !== 0 ) {
77+ r ( ) ;
78+ }
79+ } ) ) ;
9680 // Print an environment variable value so the echo statement doesn't get matched
9781 if ( process . platform === 'win32' ) {
9882 terminal . sendText ( `$env:TEST` ) ;
9983 } else {
10084 terminal . sendText ( `echo $TEST` ) ;
10185 }
10286 } ) ;
87+
88+ await new Promise < void > ( r => {
89+ terminal . dispose ( ) ;
90+ disposables . push ( window . onDidCloseTerminal ( t => {
91+ strictEqual ( terminal , t ) ;
92+ r ( ) ;
93+ } ) ) ;
94+ } ) ;
10395 } ) ;
10496
10597 test ( 'onDidCloseTerminal event fires when terminal is disposed' , async ( ) => {
0 commit comments