@@ -107,8 +107,26 @@ suite('Language server watcher', () => {
107107 } ) ;
108108
109109 test ( 'The constructor should add a listener to onDidChange to the list of disposables if it is a trusted workspace' , ( ) => {
110+ // Create a mock ILogOutputChannel
111+ const mockOutputChannel = { } as ILogOutputChannel ;
112+
113+ // Create a mock IApplicationShell with createOutputChannel method
114+ const mockApplicationShell = ( {
115+ createOutputChannel : ( ) => mockOutputChannel ,
116+ } as unknown ) as IApplicationShell ;
117+
118+ // Create a mock service container with the required get method
119+ const mockServiceContainer = {
120+ get : ( serviceIdentifier : any ) => {
121+ if ( serviceIdentifier === IApplicationShell ) {
122+ return mockApplicationShell ;
123+ }
124+ return undefined ;
125+ } ,
126+ } as IServiceContainer ;
127+
110128 watcher = new LanguageServerWatcher (
111- { } as IServiceContainer ,
129+ mockServiceContainer ,
112130
113131 {
114132 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -152,8 +170,26 @@ suite('Language server watcher', () => {
152170 } ) ;
153171
154172 test ( 'The constructor should not add a listener to onDidChange to the list of disposables if it is not a trusted workspace' , ( ) => {
173+ // Create a mock ILogOutputChannel
174+ const mockOutputChannel = { } as ILogOutputChannel ;
175+
176+ // Create a mock IApplicationShell with createOutputChannel method
177+ const mockApplicationShell = ( {
178+ createOutputChannel : ( ) => mockOutputChannel ,
179+ } as unknown ) as IApplicationShell ;
180+
181+ // Create a mock service container with the required get method
182+ const mockServiceContainer = {
183+ get : ( serviceIdentifier : any ) => {
184+ if ( serviceIdentifier === IApplicationShell ) {
185+ return mockApplicationShell ;
186+ }
187+ return undefined ;
188+ } ,
189+ } as IServiceContainer ;
190+
155191 watcher = new LanguageServerWatcher (
156- { } as IServiceContainer ,
192+ mockServiceContainer ,
157193
158194 {
159195 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -218,13 +254,26 @@ suite('Language server watcher', () => {
218254 } ,
219255 } as unknown ) as IInterpreterService ;
220256
221- watcher = new LanguageServerWatcher (
222- ( {
223- get : ( ) => {
224- /* do nothing */
225- } ,
226- } as unknown ) as IServiceContainer ,
257+ // Create a mock ILogOutputChannel
258+ const mockOutputChannel = { } as ILogOutputChannel ;
259+
260+ // Create a mock IApplicationShell with createOutputChannel method
261+ const mockApplicationShell = ( {
262+ createOutputChannel : ( ) => mockOutputChannel ,
263+ } as unknown ) as IApplicationShell ;
264+
265+ // Create a mock service container with the required get method
266+ const mockServiceContainer = {
267+ get : ( serviceIdentifier : any ) => {
268+ if ( serviceIdentifier === IApplicationShell ) {
269+ return mockApplicationShell ;
270+ }
271+ return undefined ;
272+ } ,
273+ } as IServiceContainer ;
227274
275+ watcher = new LanguageServerWatcher (
276+ mockServiceContainer ,
228277 {
229278 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
230279 } as IConfigurationService ,
@@ -298,8 +347,26 @@ suite('Language server watcher', () => {
298347 output = output . concat ( ...( args as string [ ] ) ) ;
299348 } ) ;
300349
350+ // Create a mock ILogOutputChannel
351+ const mockOutputChannel = { } as ILogOutputChannel ;
352+
353+ // Create a mock IApplicationShell with createOutputChannel method
354+ const mockApplicationShell = ( {
355+ createOutputChannel : ( ) => mockOutputChannel ,
356+ } as unknown ) as IApplicationShell ;
357+
358+ // Create a mock service container with the required get method
359+ const mockServiceContainer = {
360+ get : ( serviceIdentifier : any ) => {
361+ if ( serviceIdentifier === IApplicationShell ) {
362+ return mockApplicationShell ;
363+ }
364+ return undefined ;
365+ } ,
366+ } as IServiceContainer ;
367+
301368 watcher = new LanguageServerWatcher (
302- { } as IServiceContainer ,
369+ mockServiceContainer ,
303370
304371 {
305372 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -385,8 +452,26 @@ suite('Language server watcher', () => {
385452 } ,
386453 } as unknown ) as IWorkspaceService ;
387454
455+ // Create a mock ILogOutputChannel
456+ const mockOutputChannel = { } as ILogOutputChannel ;
457+
458+ // Create a mock IApplicationShell with createOutputChannel method
459+ const mockApplicationShell = ( {
460+ createOutputChannel : ( ) => mockOutputChannel ,
461+ } as unknown ) as IApplicationShell ;
462+
463+ // Create a mock service container with the required get method
464+ const mockServiceContainer = {
465+ get : ( serviceIdentifier : any ) => {
466+ if ( serviceIdentifier === IApplicationShell ) {
467+ return mockApplicationShell ;
468+ }
469+ return undefined ;
470+ } ,
471+ } as IServiceContainer ;
472+
388473 watcher = new LanguageServerWatcher (
389- { } as IServiceContainer ,
474+ mockServiceContainer ,
390475
391476 {
392477 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -527,8 +612,26 @@ suite('Language server watcher', () => {
527612 const startLanguageServerStub = sandbox . stub ( NoneLSExtensionManager . prototype , 'startLanguageServer' ) ;
528613 startLanguageServerStub . returns ( Promise . resolve ( ) ) ;
529614
615+ // Create a mock ILogOutputChannel
616+ const mockOutputChannel = { } as ILogOutputChannel ;
617+
618+ // Create a mock IApplicationShell with createOutputChannel method
619+ const mockApplicationShell = ( {
620+ createOutputChannel : ( ) => mockOutputChannel ,
621+ } as unknown ) as IApplicationShell ;
622+
623+ // Create a mock service container with the required get method
624+ const mockServiceContainer = {
625+ get : ( serviceIdentifier : any ) => {
626+ if ( serviceIdentifier === IApplicationShell ) {
627+ return mockApplicationShell ;
628+ }
629+ return undefined ;
630+ } ,
631+ } as IServiceContainer ;
632+
530633 watcher = new LanguageServerWatcher (
531- { } as IServiceContainer ,
634+ mockServiceContainer ,
532635
533636 {
534637 getSettings : ( ) => ( { languageServer : LanguageServerType . Jedi } ) ,
@@ -583,8 +686,26 @@ suite('Language server watcher', () => {
583686 const startLanguageServerStub = sandbox . stub ( NoneLSExtensionManager . prototype , 'startLanguageServer' ) ;
584687 startLanguageServerStub . returns ( Promise . resolve ( ) ) ;
585688
689+ // Create a mock ILogOutputChannel
690+ const mockOutputChannel = { } as ILogOutputChannel ;
691+
692+ // Create a mock IApplicationShell with createOutputChannel method
693+ const mockApplicationShell = ( {
694+ createOutputChannel : ( ) => mockOutputChannel ,
695+ } as unknown ) as IApplicationShell ;
696+
697+ // Create a mock service container with the required get method
698+ const mockServiceContainer = {
699+ get : ( serviceIdentifier : any ) => {
700+ if ( serviceIdentifier === IApplicationShell ) {
701+ return mockApplicationShell ;
702+ }
703+ return undefined ;
704+ } ,
705+ } as IServiceContainer ;
706+
586707 watcher = new LanguageServerWatcher (
587- { } as IServiceContainer ,
708+ mockServiceContainer ,
588709
589710 {
590711 getSettings : ( ) => ( { languageServer : LanguageServerType . Jedi } ) ,
@@ -775,8 +896,26 @@ suite('Language server watcher', () => {
775896 isTrusted : true ,
776897 } as unknown ) as IWorkspaceService ;
777898
899+ // Create a mock ILogOutputChannel
900+ const mockOutputChannel = { } as ILogOutputChannel ;
901+
902+ // Create a mock IApplicationShell with createOutputChannel method
903+ const mockApplicationShell = ( {
904+ createOutputChannel : ( ) => mockOutputChannel ,
905+ } as unknown ) as IApplicationShell ;
906+
907+ // Create a mock service container with the required get method
908+ const mockServiceContainer = {
909+ get : ( serviceIdentifier : any ) => {
910+ if ( serviceIdentifier === IApplicationShell ) {
911+ return mockApplicationShell ;
912+ }
913+ return undefined ;
914+ } ,
915+ } as IServiceContainer ;
916+
778917 watcher = new LanguageServerWatcher (
779- { } as IServiceContainer ,
918+ mockServiceContainer ,
780919
781920 {
782921 getSettings : ( ) => ( { languageServer } ) ,
@@ -853,12 +992,26 @@ suite('Language server watcher', () => {
853992 } ) ,
854993 } as unknown ) as IInterpreterService ;
855994
995+ // Create a mock ILogOutputChannel
996+ const mockOutputChannel = { } as ILogOutputChannel ;
997+
998+ // Create a mock IApplicationShell with createOutputChannel method
999+ const mockApplicationShell = ( {
1000+ createOutputChannel : ( ) => mockOutputChannel ,
1001+ } as unknown ) as IApplicationShell ;
1002+
1003+ // Create a mock service container with the required get method
1004+ const mockServiceContainer = {
1005+ get : ( serviceIdentifier : any ) => {
1006+ if ( serviceIdentifier === IApplicationShell ) {
1007+ return mockApplicationShell ;
1008+ }
1009+ return undefined ;
1010+ } ,
1011+ } as IServiceContainer ;
1012+
8561013 watcher = new LanguageServerWatcher (
857- ( {
858- get : ( ) => {
859- /* do nothing */
860- } ,
861- } as unknown ) as IServiceContainer ,
1014+ mockServiceContainer ,
8621015
8631016 {
8641017 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -933,7 +1086,30 @@ suite('Language server watcher', () => {
9331086 getActiveInterpreter : ( ) => info ,
9341087 } as unknown ) as IInterpreterService ;
9351088
1089+ // Create a mock ILogOutputChannel
1090+ const mockOutputChannel = { } as ILogOutputChannel ;
1091+
1092+ // Create a mock IApplicationShell with createOutputChannel method
1093+ const mockApplicationShell = ( {
1094+ createOutputChannel : ( ) => mockOutputChannel ,
1095+ } as unknown ) as IApplicationShell ;
1096+
1097+ // Create a mock service container with the required get method
1098+ const mockServiceContainer = {
1099+ get : ( serviceIdentifier : any ) => {
1100+ if ( serviceIdentifier === IApplicationShell ) {
1101+ return mockApplicationShell ;
1102+ }
1103+ return undefined ;
1104+ } ,
1105+ } as IServiceContainer ;
1106+
9361107 watcher = new LanguageServerWatcher (
1108+ mockServiceContainer ,
1109+ {
1110+ getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
1111+ } as IConfigurationService ,
1112+ { } as IExperimentService ,
9371113 ( {
9381114 get : ( ) => {
9391115 /* do nothing */
@@ -1016,12 +1192,26 @@ suite('Language server watcher', () => {
10161192 } ) ,
10171193 } as unknown ) as IInterpreterService ;
10181194
1195+ // Create a mock ILogOutputChannel
1196+ const mockOutputChannel = { } as ILogOutputChannel ;
1197+
1198+ // Create a mock IApplicationShell with createOutputChannel method
1199+ const mockApplicationShell = ( {
1200+ createOutputChannel : ( ) => mockOutputChannel ,
1201+ } as unknown ) as IApplicationShell ;
1202+
1203+ // Create a mock service container with the required get method
1204+ const mockServiceContainer = {
1205+ get : ( serviceIdentifier : any ) => {
1206+ if ( serviceIdentifier === IApplicationShell ) {
1207+ return mockApplicationShell ;
1208+ }
1209+ return undefined ;
1210+ } ,
1211+ } as IServiceContainer ;
1212+
10191213 watcher = new LanguageServerWatcher (
1020- ( {
1021- get : ( ) => {
1022- /* do nothing */
1023- } ,
1024- } as unknown ) as IServiceContainer ,
1214+ mockServiceContainer ,
10251215
10261216 {
10271217 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
@@ -1099,12 +1289,26 @@ suite('Language server watcher', () => {
10991289 } ) ,
11001290 } as unknown ) as IInterpreterService ;
11011291
1292+ // Create a mock ILogOutputChannel
1293+ const mockOutputChannel = { } as ILogOutputChannel ;
1294+
1295+ // Create a mock IApplicationShell with createOutputChannel method
1296+ const mockApplicationShell = ( {
1297+ createOutputChannel : ( ) => mockOutputChannel ,
1298+ } as unknown ) as IApplicationShell ;
1299+
1300+ // Create a mock service container with the required get method
1301+ const mockServiceContainer = {
1302+ get : ( serviceIdentifier : any ) => {
1303+ if ( serviceIdentifier === IApplicationShell ) {
1304+ return mockApplicationShell ;
1305+ }
1306+ return undefined ;
1307+ } ,
1308+ } as IServiceContainer ;
1309+
11021310 watcher = new LanguageServerWatcher (
1103- ( {
1104- get : ( ) => {
1105- /* do nothing */
1106- } ,
1107- } as unknown ) as IServiceContainer ,
1311+ mockServiceContainer ,
11081312
11091313 {
11101314 getSettings : ( ) => ( { languageServer : LanguageServerType . None } ) ,
0 commit comments