@@ -32,9 +32,9 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
3232 async runTests (
3333 uri : Uri ,
3434 testIds : string [ ] ,
35- profileKind ?: TestRunProfileKind ,
36- runInstance ? : TestRun ,
37- executionFactory ? : IPythonExecutionFactory ,
35+ profileKind : boolean | TestRunProfileKind | undefined ,
36+ runInstance : TestRun ,
37+ executionFactory : IPythonExecutionFactory ,
3838 debugLauncher ?: ITestDebugLauncher ,
3939 interpreter ?: PythonEnvironment ,
4040 ) : Promise < void > {
@@ -49,14 +49,14 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
4949 }
5050 } ;
5151 const cSource = new CancellationTokenSource ( ) ;
52- runInstance ? .token . onCancellationRequested ( ( ) => cSource . cancel ( ) ) ;
52+ runInstance . token . onCancellationRequested ( ( ) => cSource . cancel ( ) ) ;
5353
5454 const name = await utils . startRunResultNamedPipe (
5555 dataReceivedCallback , // callback to handle data received
5656 deferredTillServerClose , // deferred to resolve when server closes
5757 cSource . token , // token to cancel
5858 ) ;
59- runInstance ? .token . onCancellationRequested ( ( ) => {
59+ runInstance . token . onCancellationRequested ( ( ) => {
6060 traceInfo ( `Test run cancelled, resolving 'TillServerClose' deferred for ${ uri . fsPath } .` ) ;
6161 } ) ;
6262
@@ -82,9 +82,9 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
8282 testIds : string [ ] ,
8383 resultNamedPipeName : string ,
8484 serverCancel : CancellationTokenSource ,
85- runInstance ? : TestRun ,
86- profileKind ?: TestRunProfileKind ,
87- executionFactory ? : IPythonExecutionFactory ,
85+ runInstance : TestRun ,
86+ profileKind : boolean | TestRunProfileKind | undefined ,
87+ executionFactory : IPythonExecutionFactory ,
8888 debugLauncher ?: ITestDebugLauncher ,
8989 interpreter ?: PythonEnvironment ,
9090 ) : Promise < ExecutionTestPayload > {
@@ -114,7 +114,7 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
114114 interpreter,
115115 } ;
116116 // need to check what will happen in the exec service is NOT defined and is null
117- const execService = await executionFactory ? .createActivatedEnvironment ( creationOptions ) ;
117+ const execService = await executionFactory . createActivatedEnvironment ( creationOptions ) ;
118118
119119 const execInfo = await execService ?. getExecutablePath ( ) ;
120120 traceVerbose ( `Executable path for pytest execution: ${ execInfo } .` ) ;
@@ -144,14 +144,14 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
144144 cwd,
145145 throwOnStdErr : true ,
146146 env : mutableEnv ,
147- token : runInstance ? .token ,
147+ token : runInstance . token ,
148148 } ;
149149
150150 if ( debugBool ) {
151151 const launchOptions : LaunchOptions = {
152152 cwd,
153153 args : testArgs ,
154- token : runInstance ? .token ,
154+ token : runInstance . token ,
155155 testProvider : PYTEST_PROVIDER ,
156156 runTestIdsPort : testIdsFileName ,
157157 pytestPort : resultNamedPipeName ,
@@ -181,19 +181,19 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
181181 args : runArgs ,
182182 env : ( mutableEnv as unknown ) as { [ key : string ] : string } ,
183183 } ) ;
184- runInstance ? .token . onCancellationRequested ( ( ) => {
184+ runInstance . token . onCancellationRequested ( ( ) => {
185185 traceInfo ( `Test run cancelled, killing pytest subprocess for workspace ${ uri . fsPath } ` ) ;
186186 proc . kill ( ) ;
187187 deferredTillExecClose . resolve ( ) ;
188188 serverCancel . cancel ( ) ;
189189 } ) ;
190190 proc . stdout . on ( 'data' , ( data ) => {
191191 const out = utils . fixLogLinesNoTrailing ( data . toString ( ) ) ;
192- runInstance ? .appendOutput ( out ) ;
192+ runInstance . appendOutput ( out ) ;
193193 } ) ;
194194 proc . stderr . on ( 'data' , ( data ) => {
195195 const out = utils . fixLogLinesNoTrailing ( data . toString ( ) ) ;
196- runInstance ? .appendOutput ( out ) ;
196+ runInstance . appendOutput ( out ) ;
197197 } ) ;
198198 proc . onExit ( ( code , signal ) => {
199199 if ( code !== 0 ) {
@@ -218,7 +218,7 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
218218
219219 let resultProc : ChildProcess | undefined ;
220220
221- runInstance ? .token . onCancellationRequested ( ( ) => {
221+ runInstance . token . onCancellationRequested ( ( ) => {
222222 traceInfo ( `Test run cancelled, killing pytest subprocess for workspace ${ uri . fsPath } ` ) ;
223223 // if the resultProc exists just call kill on it which will handle resolving the ExecClose deferred, otherwise resolve the deferred here.
224224 if ( resultProc ) {
@@ -235,11 +235,11 @@ export class PytestTestExecutionAdapter implements ITestExecutionAdapter {
235235 // Displays output to user and ensure the subprocess doesn't run into buffer overflow.
236236 result ?. proc ?. stdout ?. on ( 'data' , ( data ) => {
237237 const out = utils . fixLogLinesNoTrailing ( data . toString ( ) ) ;
238- runInstance ? .appendOutput ( out ) ;
238+ runInstance . appendOutput ( out ) ;
239239 } ) ;
240240 result ?. proc ?. stderr ?. on ( 'data' , ( data ) => {
241241 const out = utils . fixLogLinesNoTrailing ( data . toString ( ) ) ;
242- runInstance ? .appendOutput ( out ) ;
242+ runInstance . appendOutput ( out ) ;
243243 } ) ;
244244 result ?. proc ?. on ( 'exit' , ( code , signal ) => {
245245 if ( code !== 0 ) {
0 commit comments