Skip to content

Commit cc91a0a

Browse files
authored
resolved merge conflicts (#11919)
1 parent 85616f8 commit cc91a0a

File tree

6 files changed

+94
-94
lines changed

6 files changed

+94
-94
lines changed

Tasks/VsTestV2/distributedtest.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Tasks/VsTestV2/inputdatacontract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export interface ExecutionSettings {
9696
DefaultTestBatchSize : number;
9797
AssemblyLevelParallelism : boolean;
9898
CodeCoverageEnabled : boolean;
99-
PathToCustomTestAdapters : string;
99+
PathToCustomTestAdapters : string;
100100
ProceedAfterAbortedTestCase : boolean;
101101
PathToCustomVsTestConsoleWrapperAssembly : string;
102102
SettingsFile : string;

Tasks/VsTestV2/nondistributedtest.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export class NonDistributedTest {
2121

2222
private async invokeDtaExecutionHost() {
2323
try {
24-
2524
console.log(tl.loc('runTestsLocally', 'vstest.console.exe'));
2625
console.log('========================================================');
2726
const exitCode = await this.startDtaExecutionHost();
@@ -40,7 +39,6 @@ export class NonDistributedTest {
4039
}
4140

4241
} catch (err) {
43-
tl.error(err);
4442
tl.setResult(tl.TaskResult.Failed, tl.loc('VstestFailedReturnCode'), true);
4543
}
4644
}
@@ -103,10 +101,10 @@ export class NonDistributedTest {
103101
console.log(tl.loc('UserProvidedSourceFilter', this.sourceFilter.toString()));
104102
const telemetryProps: { [key: string]: any; } = { MiniMatchLines: this.sourceFilter.length };
105103
telemetryProps.ExecutionFlow = 'NonDistributed';
106-
var start = new Date().getTime();
104+
const start = new Date().getTime();
107105
const sources = tl.findMatch(this.inputDataContract.TestSelectionSettings.SearchFolder, this.sourceFilter);
108-
var timeTaken = new Date().getTime() - start;
109-
tl.debug( `Time taken for applying the minimatch pattern to filter out the sources ${timeTaken} ms` );
106+
const timeTaken = new Date().getTime() - start;
107+
tl.debug(`Time taken for applying the minimatch pattern to filter out the sources ${timeTaken} ms`);
110108
telemetryProps.TimeToSearchDLLsInMilliSeconds = timeTaken;
111109
tl.debug(`${sources.length} files matched the given minimatch filter`);
112110
ci.publishTelemetry('TestExecution','MinimatchFilterPerformance', telemetryProps);
@@ -120,8 +118,11 @@ export class NonDistributedTest {
120118
tl.debug('Files matching count :' + filesMatching.length);
121119
if (filesMatching.length === 0) {
122120
tl.warning(tl.loc('noTestSourcesFound', this.sourceFilter.toString()));
123-
if (this.inputDataContract.TestReportingSettings.ExecutionStatusSettings.ActionOnThresholdNotMet.toLowerCase() == "fail") {
121+
if (this.inputDataContract.TestReportingSettings.ExecutionStatusSettings.ActionOnThresholdNotMet.toLowerCase() === 'fail') {
124122
throw new Error(tl.loc('minTestsNotExecuted', this.inputDataContract.TestReportingSettings.ExecutionStatusSettings.MinimumExecutedTestsExpected));
123+
} else {
124+
tl.setResult(tl.TaskResult.Succeeded, tl.loc('noTestSourcesFound', this.sourceFilter.toString()), true);
125+
process.exit(0);
125126
}
126127
}
127128

@@ -135,6 +136,5 @@ export class NonDistributedTest {
135136
}
136137

137138
private inputDataContract: InputDataContract;
138-
private testAssemblyFiles: string[];
139139
private sourceFilter: string[] = tl.getDelimitedInput('testAssemblyVer2', '\n', true);
140140
}

0 commit comments

Comments
 (0)