@@ -36,15 +36,12 @@ export class DistributedTest {
3636 }
3737 } catch ( error ) {
3838 ci . publishEvent ( { environmenturi : this . inputDataContract . RunIdentifier , error : error } ) ;
39- tl . error ( error ) ;
4039 tl . setResult ( tl . TaskResult . Failed , error , true ) ;
4140 }
4241 }
4342
4443 private async startDtaExecutionHost ( ) : Promise < number > {
45-
46- // let envVars: { [key: string]: string; } = <{ [key: string]: string; }>{};
47- let envVars : { [ key : string ] : string ; } = process . env ; // This is a temporary solution where we are passing parent process env vars, we should get away from this
44+ let envVars : { [ key : string ] : string ; } = process . env ;
4845
4946 // Overriding temp with agent temp
5047 utils . Helper . addToProcessEnvVars ( envVars , 'temp' , utils . Helper . GetTempFolder ( ) ) ;
@@ -75,7 +72,7 @@ export class DistributedTest {
7572
7673 const dtaExecutionHostTool = tl . tool ( path . join ( __dirname , 'Modules/DTAExecutionHost.exe' ) ) ;
7774 dtaExecutionHostTool . arg ( [ '--inputFile' , inputFilePath ] ) ;
78- const code = await dtaExecutionHostTool . exec ( < tr . IExecOptions > { ignoreReturnCode :this . inputDataContract . TestReportingSettings . ExecutionStatusSettings . IgnoreTestFailures , env : envVars } ) ;
75+ const code = await dtaExecutionHostTool . exec ( < tr . IExecOptions > { ignoreReturnCode : this . inputDataContract . TestReportingSettings . ExecutionStatusSettings . IgnoreTestFailures , env : envVars } ) ;
7976
8077 //hydra: add consolidated ci for inputs in C# layer for now
8178 const consolidatedCiData = {
@@ -101,13 +98,13 @@ export class DistributedTest {
10198 }
10299 const telemetryProps : { [ key : string ] : any ; } = { MiniMatchLines : sourceFilter . length } ;
103100 telemetryProps . ExecutionFlow = 'Distributed' ;
104- var start = new Date ( ) . getTime ( ) ;
101+ const start = new Date ( ) . getTime ( ) ;
105102 const sources = tl . findMatch ( this . inputDataContract . TestSelectionSettings . SearchFolder , sourceFilter ) ;
106103 tl . debug ( `${ sources . length } files matched the given minimatch filter` ) ;
107- var timeTaken = new Date ( ) . getTime ( ) - start ;
108- tl . debug ( `Time taken for applying the minimatch pattern to filter out the sources ${ timeTaken } ms` ) ;
104+ const timeTaken = new Date ( ) . getTime ( ) - start ;
105+ tl . debug ( `Time taken for applying the minimatch pattern to filter out the sources ${ timeTaken } ms` ) ;
109106 telemetryProps . TimeToSearchDLLsInMilliSeconds = timeTaken ;
110- ci . publishTelemetry ( 'TestExecution' , 'MinimatchFilterPerformance' , telemetryProps ) ;
107+ ci . publishTelemetry ( 'TestExecution' , 'MinimatchFilterPerformance' , telemetryProps ) ;
111108 const filesMatching = [ ] ;
112109 sources . forEach ( function ( match : string ) {
113110 if ( ! fs . lstatSync ( match ) . isDirectory ( ) ) {
@@ -118,8 +115,11 @@ export class DistributedTest {
118115 tl . debug ( 'Files matching count :' + filesMatching . length ) ;
119116 if ( filesMatching . length === 0 ) {
120117 tl . warning ( tl . loc ( 'noTestSourcesFound' , sourceFilter . toString ( ) ) ) ;
121- if ( this . inputDataContract . TestReportingSettings . ExecutionStatusSettings . ActionOnThresholdNotMet . toLowerCase ( ) == " fail" ) {
118+ if ( this . inputDataContract . TestReportingSettings . ExecutionStatusSettings . ActionOnThresholdNotMet . toLowerCase ( ) === ' fail' ) {
122119 throw new Error ( tl . loc ( 'minTestsNotExecuted' , this . inputDataContract . TestReportingSettings . ExecutionStatusSettings . MinimumExecutedTestsExpected ) ) ;
120+ } else {
121+ tl . setResult ( tl . TaskResult . Succeeded , tl . loc ( 'noTestSourcesFound' , sourceFilter . toString ( ) ) , true ) ;
122+ process . exit ( 0 ) ;
123123 }
124124 }
125125
0 commit comments