Skip to content

Commit 6316431

Browse files
committed
Reverts task lib require and fixes tests
1 parent e9f210e commit 6316431

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

buildAndReleaseTask/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tl = require('azure-pipelines-task-lib');
1+
import tl = require('azure-pipelines-task-lib/task');
22
import { promises as fsPromises } from 'fs';
33
import { DOMParser, XMLSerializer } from 'xmldom';
44

buildAndReleaseTask/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 1,
17-
"Patch": 0
17+
"Patch": 1
1818
},
1919
"instanceNameFormat": "Transform cscfg $(targetFilePath)",
2020
"inputs": [

buildAndReleaseTask/tests/_suite.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,23 @@ describe('Sample task tests', function () {
1919
tr.run();
2020
console.log(tr.succeeded);
2121
assert.equal(tr.succeeded, true, 'should have succeeded');
22-
assert.equal(tr.warningIssues.length, 0, "should have no warnings");
2322
assert.equal(tr.errorIssues.length, 0, "should have no errors");
2423
console.log(tr.stdout);
25-
assert.equal(tr.stdout.indexOf('Hello human') >= 0, true, "should display Hello human");
2624
done();
2725
});
2826

2927
it('it should fail if tool returns 1', function(done: MochaDone) {
3028
this.timeout(1000);
3129

32-
let tp = path.join(__dirname, 'failure.js');
30+
let tp = path.join(__dirname, 'no-input-failure.js');
3331
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
3432

3533
tr.run();
3634
console.log(tr.succeeded);
3735
assert.equal(tr.succeeded, false, 'should have failed');
3836
assert.equal(tr.warningIssues, 0, "should have no warnings");
3937
assert.equal(tr.errorIssues.length, 1, "should have 1 error issue");
40-
assert.equal(tr.errorIssues[0], 'Bad input was given', 'error issue output');
41-
assert.equal(tr.stdout.indexOf('Hello bad'), -1, "Should not display Hello bad");
38+
assert.equal(tr.errorIssues[0], 'Input required: targetFilePath', 'error issue output');
4239

4340
done();
4441
});

buildAndReleaseTask/tests/failure.ts renamed to buildAndReleaseTask/tests/no-input-failure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import path = require('path');
55
let taskPath = path.join(__dirname, '..', 'index.js');
66
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
77

8-
tmr.setInput('samplestring', 'bad');
8+
tmr.setInput('unrelated', 'nope!');
99

1010
tmr.run();

buildAndReleaseTask/tests/success.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import ma = require('azure-pipelines-task-lib/mock-answer');
22
import tmrm = require('azure-pipelines-task-lib/mock-run');
33
import path = require('path');
4+
import fs = require("fs");
5+
6+
const filePath = path.join(__dirname, 'empty.cscfg');
7+
fs.writeFileSync(filePath, '<ServiceConfiguration><Role><ConfigurationSettings /></Role></ServiceConfiguration>')
48

59
let taskPath = path.join(__dirname, '..', 'index.js');
610
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
711

8-
tmr.setInput('samplestring', 'human');
12+
tmr.setInput('targetFilePath', filePath);
913

10-
tmr.run();
14+
try {
15+
tmr.run();
16+
}
17+
finally {
18+
fs.unlinkSync(filePath);
19+
}

vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifestVersion": 1,
33
"id": "cscfg-transform",
44
"name": "Azure Cloud Services Config Variable Transform",
5-
"version": "0.1.0",
5+
"version": "0.1.1",
66
"publisher": "rezStream",
77
"targets": [
88
{

0 commit comments

Comments
 (0)