@@ -11,7 +11,7 @@ import {
1111 TerminalShellExecution ,
1212 TerminalShellExecutionEndEvent ,
1313 TerminalShellIntegration ,
14- // Uri,
14+ Uri ,
1515 Terminal as VSCodeTerminal ,
1616 WorkspaceConfiguration ,
1717} from 'vscode' ;
@@ -22,7 +22,7 @@ import { TerminalService } from '../../../client/common/terminal/service';
2222import {
2323 ITerminalActivator ,
2424 ITerminalHelper ,
25- // TerminalCreationOptions,
25+ TerminalCreationOptions ,
2626 TerminalShellType ,
2727} from '../../../client/common/terminal/types' ;
2828import { IDisposableRegistry } from '../../../client/common/types' ;
@@ -33,7 +33,7 @@ import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis'
3333import * as platform from '../../../client/common/utils/platform' ;
3434import * as extapi from '../../../client/envExt/api.internal' ;
3535import { IInterpreterService } from '../../../client/interpreter/contracts' ;
36- // import { PythonEnvironment } from '../../../client/pythonEnvironments/info';
36+ import { PythonEnvironment } from '../../../client/pythonEnvironments/info' ;
3737
3838suite ( 'Terminal Service' , ( ) => {
3939 let service : TerminalService ;
@@ -55,7 +55,7 @@ suite('Terminal Service', () => {
5555 let isWindowsStub : sinon . SinonStub ;
5656 let useEnvExtensionStub : sinon . SinonStub ;
5757 let interpreterService : TypeMoq . IMock < IInterpreterService > ;
58- // let options: TypeMoq.IMock<TerminalCreationOptions>;
58+ let options : TypeMoq . IMock < TerminalCreationOptions > ;
5959
6060 setup ( ( ) => {
6161 useEnvExtensionStub = sinon . stub ( extapi , 'useEnvExtension' ) ;
@@ -102,13 +102,13 @@ suite('Terminal Service', () => {
102102 disposables = [ ] ;
103103
104104 mockServiceContainer = TypeMoq . Mock . ofType < IServiceContainer > ( ) ;
105- // interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
106- // interpreterService
107- // .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny()))
108- // .returns(() => Promise.resolve(({ path: 'ps' } as unknown) as PythonEnvironment));
105+ interpreterService = TypeMoq . Mock . ofType < IInterpreterService > ( ) ;
106+ interpreterService
107+ . setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isAny ( ) ) )
108+ . returns ( ( ) => Promise . resolve ( ( { path : 'ps' } as unknown ) as PythonEnvironment ) ) ;
109109
110- // options = TypeMoq.Mock.ofType<TerminalCreationOptions>();
111- // options.setup((o) => o.resource).returns(() => Uri.parse('a'));
110+ options = TypeMoq . Mock . ofType < TerminalCreationOptions > ( ) ;
111+ options . setup ( ( o ) => o . resource ) . returns ( ( ) => Uri . parse ( 'a' ) ) ;
112112
113113 mockServiceContainer . setup ( ( c ) => c . get ( ITerminalManager ) ) . returns ( ( ) => terminalManager . object ) ;
114114 mockServiceContainer . setup ( ( c ) => c . get ( ITerminalHelper ) ) . returns ( ( ) => terminalHelper . object ) ;
@@ -259,57 +259,57 @@ suite('Terminal Service', () => {
259259 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
260260 } ) ;
261261
262- // test('Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux && Python < 3.13', async () => {
263- // isWindowsStub.returns(false);
264- // pythonConfig
265- // .setup((p) => p.get('terminal.shellIntegration.enabled'))
266- // .returns(() => true)
267- // .verifiable(TypeMoq.Times.once());
268-
269- // terminalHelper
270- // .setup((helper) => helper.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
271- // .returns(() => Promise.resolve(undefined));
272- // service = new TerminalService(mockServiceContainer.object);
273- // const textToSend = 'Some Text';
274- // terminalHelper.setup((h) => h.identifyTerminalShell(TypeMoq.It.isAny())).returns(() => TerminalShellType.bash);
275- // terminalManager.setup((t) => t.createTerminal(TypeMoq.It.isAny())).returns(() => terminal.object);
276-
277- // service.ensureTerminal();
278- // service.executeCommand(textToSend, true);
279-
280- // terminal.verify((t) => t.show(TypeMoq.It.isValue(true)), TypeMoq.Times.exactly(1));
281- // terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.never());
282- // });
283-
284- // test('Ensure sendText is called when Python shell integration and terminal shell integration are both enabled - Mac, Linux && Python >= 3.13', async () => {
285- // interpreterService.reset();
286-
287- // interpreterService
288- // .setup((i) => i.getActiveInterpreter(TypeMoq.It.isAny()))
289- // .returns(() =>
290- // Promise.resolve({ path: 'yo', version: { major: 3, minor: 13, patch: 0 } } as PythonEnvironment),
291- // );
292-
293- // isWindowsStub.returns(false);
294- // pythonConfig
295- // .setup((p) => p.get('terminal.shellIntegration.enabled'))
296- // .returns(() => true)
297- // .verifiable(TypeMoq.Times.once());
298-
299- // terminalHelper
300- // .setup((helper) => helper.getEnvironmentActivationCommands(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
301- // .returns(() => Promise.resolve(undefined));
302-
303- // service = new TerminalService(mockServiceContainer.object, options.object);
304- // const textToSend = 'Some Text';
305- // terminalHelper.setup((h) => h.identifyTerminalShell(TypeMoq.It.isAny())).returns(() => TerminalShellType.bash);
306- // terminalManager.setup((t) => t.createTerminal(TypeMoq.It.isAny())).returns(() => terminal.object);
307-
308- // await service.ensureTerminal();
309- // await service.executeCommand(textToSend, true);
310-
311- // terminal.verify((t) => t.sendText(TypeMoq.It.isValue(textToSend)), TypeMoq.Times.once());
312- // });
262+ test ( 'Ensure sendText is NOT called when Python shell integration and terminal shell integration are both enabled - Mac, Linux && Python < 3.13' , async ( ) => {
263+ isWindowsStub . returns ( false ) ;
264+ pythonConfig
265+ . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
266+ . returns ( ( ) => true )
267+ . verifiable ( TypeMoq . Times . once ( ) ) ;
268+
269+ terminalHelper
270+ . setup ( ( helper ) => helper . getEnvironmentActivationCommands ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
271+ . returns ( ( ) => Promise . resolve ( undefined ) ) ;
272+ service = new TerminalService ( mockServiceContainer . object ) ;
273+ const textToSend = 'Some Text' ;
274+ terminalHelper . setup ( ( h ) => h . identifyTerminalShell ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => TerminalShellType . bash ) ;
275+ terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
276+
277+ service . ensureTerminal ( ) ;
278+ service . executeCommand ( textToSend , true ) ;
279+
280+ terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
281+ terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . never ( ) ) ;
282+ } ) ;
283+
284+ test ( 'Ensure sendText is called when Python shell integration and terminal shell integration are both enabled - Mac, Linux && Python >= 3.13' , async ( ) => {
285+ interpreterService . reset ( ) ;
286+
287+ interpreterService
288+ . setup ( ( i ) => i . getActiveInterpreter ( TypeMoq . It . isAny ( ) ) )
289+ . returns ( ( ) =>
290+ Promise . resolve ( { path : 'yo' , version : { major : 3 , minor : 13 , patch : 0 } } as PythonEnvironment ) ,
291+ ) ;
292+
293+ isWindowsStub . returns ( false ) ;
294+ pythonConfig
295+ . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
296+ . returns ( ( ) => true )
297+ . verifiable ( TypeMoq . Times . once ( ) ) ;
298+
299+ terminalHelper
300+ . setup ( ( helper ) => helper . getEnvironmentActivationCommands ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
301+ . returns ( ( ) => Promise . resolve ( undefined ) ) ;
302+
303+ service = new TerminalService ( mockServiceContainer . object , options . object ) ;
304+ const textToSend = 'Some Text' ;
305+ terminalHelper . setup ( ( h ) => h . identifyTerminalShell ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => TerminalShellType . bash ) ;
306+ terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
307+
308+ await service . ensureTerminal ( ) ;
309+ await service . executeCommand ( textToSend , true ) ;
310+
311+ terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . once ( ) ) ;
312+ } ) ;
313313
314314 test ( 'Ensure sendText IS called even when Python shell integration and terminal shell integration are both enabled - Window' , async ( ) => {
315315 isWindowsStub . returns ( true ) ;
0 commit comments