Skip to content

Commit d6de175

Browse files
authored
Update Publish Test Results Task with task-library package (#15279)
* Update Azure-pipeline-tasks librabry * Update task version * Updated task version
1 parent 9509d68 commit d6de175

File tree

7 files changed

+216
-48
lines changed

7 files changed

+216
-48
lines changed

Tasks/PublishTestResultsV1/find-files-legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22
import * as fs from 'fs';
3-
import * as tl from 'vsts-task-lib/task';
3+
import * as tl from 'azure-pipelines-task-lib/task';
44

55
let globule = require('globule');
66

Tasks/PublishTestResultsV1/package-lock.json

Lines changed: 201 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/PublishTestResultsV1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme",
1919
"dependencies": {
2020
"globule": "^1.0.0",
21-
"vsts-task-lib": "0.7.4"
21+
"azure-pipelines-task-lib": "^2.9.3"
2222
}
2323
}

Tasks/PublishTestResultsV1/publishtestresults.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tl = require('vsts-task-lib/task');
1+
import tl = require('azure-pipelines-task-lib/task');
22
import ffl = require('./find-files-legacy');
33

44
var testRunner = tl.getInput('testRunner', true);
@@ -19,10 +19,11 @@ tl.debug('publishRunAttachments: ' + publishRunAttachments);
1919

2020
let matchingTestResultsFiles = ffl.findFiles(testResultsFiles, false, tl.getVariable('System.DefaultWorkingDirectory'));
2121
if(!matchingTestResultsFiles || matchingTestResultsFiles.length == 0) {
22-
tl.warning('No test result files matching ' + testResultsFiles + ' were found.');
23-
tl.exit(0);
22+
tl.warning('No test result files matching ' + testResultsFiles + ' were found.');
2423
}
2524
else{
2625
let tp = new tl.TestPublisher(testRunner);
2726
tp.publish(matchingTestResultsFiles, mergeResults, platform, config, testRunTitle, publishRunAttachments);
28-
}
27+
}
28+
29+
tl.setResult(tl.TaskResult.Succeeded, '');

Tasks/PublishTestResultsV1/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 0,
17-
"Patch": 47
16+
"Minor": 193,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"minimumAgentVersion": "1.83.0",

Tasks/PublishTestResultsV1/task.loc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 0,
17-
"Patch": 47
16+
"Minor": 193,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"minimumAgentVersion": "1.83.0",

Tests-Legacy/L0/PublishTestResultsV1/_suite.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ describe('Publish Test Results Suite', function () {
8686
tr.run()
8787
.then(() => {
8888
assert(tr.resultWasSet, 'task should have set a result');
89-
assert(tr.stderr.length > 0, 'should have written to stderr');
90-
assert(tr.stdErrContained('Input required: testResultsFiles'));
89+
assert(tr.stdout.length > 0, 'should have written to stderr');
90+
assert(tr.stdout.indexOf('Input required: testResultsFiles') >= 0, 'wrong error message: "' + tr.stdout + '"');
9191
assert(tr.failed, 'task should have failed');
9292
assert(tr.invokedToolCount == 0, 'should exit before running PublishTestResults');
9393

@@ -106,8 +106,8 @@ describe('Publish Test Results Suite', function () {
106106
tr.run()
107107
.then(() => {
108108
assert(tr.resultWasSet, 'task should have set a result');
109-
assert(tr.stderr.length > 0, 'should have written to stderr');
110-
assert(tr.stdErrContained('Input required: testRunner'));
109+
assert(tr.stdout.length > 0, 'should have written to stdout');
110+
assert(tr.stdout.indexOf('Input required: testRunner') >= 0, 'wrong error message: "' + tr.stdout + '"');
111111
assert(tr.failed, 'task should have failed');
112112
assert(tr.invokedToolCount == 0, 'should exit before running PublishTestResults');
113113

0 commit comments

Comments
 (0)