azure-pipelines-tasks-webdeployment-common 4.230.1 → 4.230.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tests/L0.d.ts +1 -0
- package/Tests/L0.js +23 -0
- package/Tests/L0.ts +22 -0
- package/Tests/L0CopyDirectory.d.ts +1 -5
- package/Tests/L0CopyDirectory.js +89 -51
- package/Tests/L0CopyDirectory.ts +93 -55
- package/Tests/L0GenerateWebConfig.d.ts +1 -2
- package/Tests/L0GenerateWebConfig.js +55 -24
- package/Tests/L0GenerateWebConfig.ts +51 -31
- package/Tests/L0MSDeployUtility.d.ts +2 -16
- package/Tests/L0MSDeployUtility.js +91 -97
- package/Tests/L0MSDeployUtility.ts +91 -100
- package/Tests/L1JSONVarSubWithComments.d.ts +1 -1
- package/Tests/L1JSONVarSubWithComments.js +31 -46
- package/Tests/L1JSONVarSubWithComments.ts +40 -52
- package/Tests/L1JsonVarSub.d.ts +1 -1
- package/Tests/L1JsonVarSub.js +58 -66
- package/Tests/L1JsonVarSub.ts +67 -66
- package/Tests/L1JsonVarSubV2.d.ts +1 -1
- package/Tests/L1JsonVarSubV2.js +82 -93
- package/Tests/L1JsonVarSubV2.ts +82 -94
- package/Tests/L1ValidateFileEncoding.d.ts +2 -5
- package/Tests/L1ValidateFileEncoding.js +52 -65
- package/Tests/L1ValidateFileEncoding.ts +61 -77
- package/Tests/L1XdtTransform.d.ts +2 -3
- package/Tests/L1XdtTransform.js +48 -6
- package/Tests/L1XdtTransform.ts +57 -6
- package/Tests/L1XmlVarSub.d.ts +2 -3
- package/Tests/L1XmlVarSub.js +56 -20
- package/Tests/L1XmlVarSub.ts +81 -24
- package/ctt/ctt/ctt.exe +0 -0
- package/package.json +7 -3
- package/packageUtility.js +6 -5
- package/utility.js +1 -1
- package/webconfigutil.d.ts +3 -1
- package/xdttransformationutility.js +1 -1
package/Tests/L0.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/Tests/L0.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const L0MSDeployUtility_1 = require("./L0MSDeployUtility");
|
|
4
|
+
const L0CopyDirectory_1 = require("./L0CopyDirectory");
|
|
5
|
+
const L0GenerateWebConfig_1 = require("./L0GenerateWebConfig");
|
|
6
|
+
const L1XmlVarSub_1 = require("./L1XmlVarSub");
|
|
7
|
+
const L1XdtTransform_1 = require("./L1XdtTransform");
|
|
8
|
+
const L1JSONVarSubWithComments_1 = require("./L1JSONVarSubWithComments");
|
|
9
|
+
const L1JsonVarSub_1 = require("./L1JsonVarSub");
|
|
10
|
+
const L1JsonVarSubV2_1 = require("./L1JsonVarSubV2");
|
|
11
|
+
const L1ValidateFileEncoding_1 = require("./L1ValidateFileEncoding");
|
|
12
|
+
describe('Web deployment common tests', () => {
|
|
13
|
+
describe('GetMSDeployCmdArgs tests', L0MSDeployUtility_1.runGetMSDeployCmdArgsTests);
|
|
14
|
+
describe('GetWebDeployErrorCode tests', L0MSDeployUtility_1.runGetWebDeployErrorCodeTests);
|
|
15
|
+
describe("CopyDirectory tests", L0CopyDirectory_1.runCopyDirectoryTests);
|
|
16
|
+
describe("GenerateWebConfig tests", L0GenerateWebConfig_1.runGenerateWebCongigTests);
|
|
17
|
+
describe("L1XmlVarSub tests", L1XmlVarSub_1.runL1XmlVarSubTests);
|
|
18
|
+
describe("L1XdtTransform tests", L1XdtTransform_1.runL1XdtTransformTests);
|
|
19
|
+
describe("L1JSONVarSubWithComments tests", L1JSONVarSubWithComments_1.runL1JSONVarSubWithCommentsTests);
|
|
20
|
+
describe("L1JsonVarSub tests", L1JsonVarSub_1.runL1JsonVarSubTests);
|
|
21
|
+
describe("L1JsonVarSubV2 tests", L1JsonVarSubV2_1.runL1JsonVarSubV2Tests);
|
|
22
|
+
describe("L1ValidateFileEncoding tests", L1ValidateFileEncoding_1.runL1ValidateFileEncodingTests);
|
|
23
|
+
});
|
package/Tests/L0.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { runGetMSDeployCmdArgsTests, runGetWebDeployErrorCodeTests } from './L0MSDeployUtility';
|
|
2
|
+
import { runCopyDirectoryTests } from "./L0CopyDirectory";
|
|
3
|
+
import { runGenerateWebCongigTests } from "./L0GenerateWebConfig";
|
|
4
|
+
import { runL1XmlVarSubTests } from "./L1XmlVarSub";
|
|
5
|
+
import { runL1XdtTransformTests } from "./L1XdtTransform"
|
|
6
|
+
import { runL1JSONVarSubWithCommentsTests } from "./L1JSONVarSubWithComments";
|
|
7
|
+
import { runL1JsonVarSubTests } from "./L1JsonVarSub";
|
|
8
|
+
import { runL1JsonVarSubV2Tests } from "./L1JsonVarSubV2";
|
|
9
|
+
import { runL1ValidateFileEncodingTests } from "./L1ValidateFileEncoding";
|
|
10
|
+
|
|
11
|
+
describe('Web deployment common tests', () => {
|
|
12
|
+
describe('GetMSDeployCmdArgs tests', runGetMSDeployCmdArgsTests);
|
|
13
|
+
describe('GetWebDeployErrorCode tests', runGetWebDeployErrorCodeTests);
|
|
14
|
+
describe("CopyDirectory tests", runCopyDirectoryTests);
|
|
15
|
+
describe("GenerateWebConfig tests", runGenerateWebCongigTests);
|
|
16
|
+
describe("L1XmlVarSub tests", runL1XmlVarSubTests);
|
|
17
|
+
describe("L1XdtTransform tests", runL1XdtTransformTests);
|
|
18
|
+
describe("L1JSONVarSubWithComments tests", runL1JSONVarSubWithCommentsTests);
|
|
19
|
+
describe("L1JsonVarSub tests", runL1JsonVarSubTests);
|
|
20
|
+
describe("L1JsonVarSubV2 tests", runL1JsonVarSubV2Tests);
|
|
21
|
+
describe("L1ValidateFileEncoding tests", runL1ValidateFileEncodingTests);
|
|
22
|
+
});
|
package/Tests/L0CopyDirectory.js
CHANGED
|
@@ -1,55 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (path.endsWith('.py') || path.endsWith('.txt')) {
|
|
34
|
-
return false;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.runCopyDirectoryTests = void 0;
|
|
13
|
+
const assert = require("assert");
|
|
14
|
+
const mockery = require("mockery");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
function runCopyDirectoryTests() {
|
|
17
|
+
const fileList = [];
|
|
18
|
+
let mkdirPCount;
|
|
19
|
+
let cpfilesCount;
|
|
20
|
+
before(() => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const taskLibMock = {
|
|
22
|
+
exist: function (path) {
|
|
23
|
+
console.log("exist : " + path);
|
|
24
|
+
return fileList.map(f => f.path).indexOf(path) !== -1;
|
|
25
|
+
},
|
|
26
|
+
find: function (path) {
|
|
27
|
+
console.log("find : " + path);
|
|
28
|
+
return fileList.map(f => f.path).filter(f => f.startsWith(path));
|
|
29
|
+
},
|
|
30
|
+
mkdirP: function (path) {
|
|
31
|
+
if (fileList.filter(f => f.isDirectory).map(f => f.path).indexOf(path) !== -1) {
|
|
32
|
+
return;
|
|
35
33
|
}
|
|
36
|
-
|
|
34
|
+
mkdirPCount++;
|
|
35
|
+
fileList.push({
|
|
36
|
+
path: path,
|
|
37
|
+
isDirectory: true
|
|
38
|
+
});
|
|
39
|
+
console.log("mkdirp : " + path);
|
|
40
|
+
},
|
|
41
|
+
cp: function (source, dest, _options, _continueOnError) {
|
|
42
|
+
const files = fileList.filter(f => !f.isDirectory).map(f => f.path);
|
|
43
|
+
if (files.indexOf(source) === -1) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (files.indexOf(dest) !== -1) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
cpfilesCount++;
|
|
50
|
+
fileList.push({
|
|
51
|
+
path: dest,
|
|
52
|
+
isDirectory: false
|
|
53
|
+
});
|
|
54
|
+
console.log('cp ' + source + ' to ' + dest);
|
|
55
|
+
},
|
|
56
|
+
stats: function (path) {
|
|
57
|
+
return {
|
|
58
|
+
isDirectory: function () {
|
|
59
|
+
return fileList.some(f => f.path === path && f.isDirectory);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
debug: function (message) {
|
|
64
|
+
console.log(message);
|
|
37
65
|
}
|
|
38
66
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
mockery.registerMock('azure-pipelines-task-lib/task', taskLibMock);
|
|
68
|
+
mockery.registerMock('./packageUtility', {});
|
|
69
|
+
mockery.registerMock('./ziputility', {});
|
|
70
|
+
mockery.registerAllowable('../utility');
|
|
71
|
+
mockery.enable({
|
|
72
|
+
useCleanCache: true,
|
|
73
|
+
warnOnReplace: false,
|
|
74
|
+
warnOnUnregistered: false
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
77
|
+
after(() => {
|
|
78
|
+
mockery.disable();
|
|
79
|
+
});
|
|
80
|
+
beforeEach(() => {
|
|
81
|
+
mkdirPCount = 0;
|
|
82
|
+
cpfilesCount = 0;
|
|
83
|
+
fileList.splice(0);
|
|
84
|
+
});
|
|
85
|
+
it("Should copy files and folders as expected", () => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
fileList.push({ path: path.join("C:", "source", "path"), isDirectory: true }, { path: path.join("C:", "source", "path", "myfile.txt"), isDirectory: false }, { path: path.join("C:", "source", "path", "New Folder"), isDirectory: true }, { path: path.join("C:", "source", "path", "New Folder", "Another New Folder"), isDirectory: true }, { path: path.join("C:", "source", "New Folder", "anotherfile.py"), isDirectory: false }, { path: path.join("C:", "source", "New Folder", "Another New Folder", "mynewfile.txt"), isDirectory: false });
|
|
87
|
+
const utility = yield Promise.resolve().then(() => require('../utility'));
|
|
88
|
+
utility.copyDirectory(path.join('C:', 'source'), path.join('C:', 'destination'));
|
|
89
|
+
assert.strictEqual(cpfilesCount, 3, 'Should create three files');
|
|
90
|
+
assert.strictEqual(mkdirPCount, 6, 'Should create six folder including destination folder');
|
|
91
|
+
}));
|
|
55
92
|
}
|
|
93
|
+
exports.runCopyDirectoryTests = runCopyDirectoryTests;
|
package/Tests/L0CopyDirectory.ts
CHANGED
|
@@ -1,59 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
mockery
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if(
|
|
36
|
-
return
|
|
1
|
+
import * as assert from "assert";
|
|
2
|
+
import * as mockery from "mockery";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
|
|
5
|
+
export function runCopyDirectoryTests(): void {
|
|
6
|
+
const fileList: { path: string, isDirectory: boolean}[] = [];
|
|
7
|
+
let mkdirPCount: number;
|
|
8
|
+
let cpfilesCount: number;
|
|
9
|
+
|
|
10
|
+
before(async () => {
|
|
11
|
+
|
|
12
|
+
const taskLibMock = {
|
|
13
|
+
exist: function (path: string): boolean {
|
|
14
|
+
console.log("exist : " + path);
|
|
15
|
+
return fileList.map(f => f.path).indexOf(path) !== -1;
|
|
16
|
+
},
|
|
17
|
+
find: function (path: string): string[] {
|
|
18
|
+
console.log("find : " + path);
|
|
19
|
+
return fileList.map(f => f.path).filter(f => f.startsWith(path));
|
|
20
|
+
},
|
|
21
|
+
mkdirP: function (path: string): void {
|
|
22
|
+
if (fileList.filter(f => f.isDirectory).map(f => f.path).indexOf(path) !== -1) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
mkdirPCount++;
|
|
27
|
+
fileList.push({
|
|
28
|
+
path: path,
|
|
29
|
+
isDirectory: true
|
|
30
|
+
});
|
|
31
|
+
console.log("mkdirp : " + path);
|
|
32
|
+
},
|
|
33
|
+
cp: function (source: string, dest: string, _options: any, _continueOnError: boolean): void {
|
|
34
|
+
const files = fileList.filter(f => !f.isDirectory).map(f => f.path);
|
|
35
|
+
if (files.indexOf(source) === -1) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (files.indexOf(dest) !== -1) {
|
|
39
|
+
return;
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
cpfilesCount++;
|
|
42
|
+
fileList.push({
|
|
43
|
+
path: dest,
|
|
44
|
+
isDirectory: false
|
|
45
|
+
});
|
|
46
|
+
console.log('cp ' + source + ' to ' + dest);
|
|
47
|
+
},
|
|
48
|
+
stats: function (path: string): any {
|
|
49
|
+
return {
|
|
50
|
+
isDirectory: function (): boolean {
|
|
51
|
+
return fileList.some(f => f.path === path && f.isDirectory);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
debug: function (message: string) {
|
|
56
|
+
console.log(message);
|
|
39
57
|
}
|
|
40
58
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
mockery.registerMock('azure-pipelines-task-lib/task', taskLibMock);
|
|
60
|
+
mockery.registerMock('./packageUtility', {});
|
|
61
|
+
mockery.registerMock('./ziputility', {});
|
|
62
|
+
mockery.registerAllowable('../utility');
|
|
63
|
+
|
|
64
|
+
mockery.enable({
|
|
65
|
+
useCleanCache: true,
|
|
66
|
+
warnOnReplace: false,
|
|
67
|
+
warnOnUnregistered: false
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
after(() => {
|
|
72
|
+
mockery.disable();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
mkdirPCount = 0;
|
|
77
|
+
cpfilesCount = 0;
|
|
78
|
+
fileList.splice(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("Should copy files and folders as expected", async () => {
|
|
82
|
+
fileList.push(
|
|
83
|
+
{ path: path.join("C:", "source", "path"), isDirectory: true },
|
|
84
|
+
{ path: path.join("C:", "source", "path", "myfile.txt"), isDirectory: false },
|
|
85
|
+
{ path: path.join("C:", "source", "path", "New Folder"), isDirectory: true },
|
|
86
|
+
{ path: path.join("C:", "source", "path", "New Folder", "Another New Folder"), isDirectory: true },
|
|
87
|
+
{ path: path.join("C:", "source", "New Folder", "anotherfile.py"), isDirectory: false },
|
|
88
|
+
{ path: path.join("C:", "source", "New Folder", "Another New Folder", "mynewfile.txt"), isDirectory: false }
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const utility = await import('../utility')
|
|
92
|
+
utility.copyDirectory(path.join('C:','source'), path.join('C:', 'destination'));
|
|
59
93
|
|
|
94
|
+
assert.strictEqual(cpfilesCount, 3, 'Should create three files');
|
|
95
|
+
assert.strictEqual(mkdirPCount, 6, 'Should create six folder including destination folder');
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare
|
|
2
|
-
declare var generateWebConfig: any;
|
|
1
|
+
export declare function runGenerateWebCongigTests(): void;
|
|
@@ -1,24 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.runGenerateWebCongigTests = void 0;
|
|
13
|
+
const assert = require("assert");
|
|
14
|
+
const mockery = require("mockery");
|
|
15
|
+
function runGenerateWebCongigTests() {
|
|
16
|
+
let webConfigContents;
|
|
17
|
+
before(() => {
|
|
18
|
+
mockery.registerMock('azure-pipelines-task-lib/task', {
|
|
19
|
+
writeFile: function (_file, data, _options) {
|
|
20
|
+
console.log("web.config contents: " + data);
|
|
21
|
+
webConfigContents = data;
|
|
22
|
+
},
|
|
23
|
+
debug: function (message) {
|
|
24
|
+
console.log("##[debug]: " + message);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
mockery.registerMock('fs', {
|
|
28
|
+
readFileSync: function (_path, _format) {
|
|
29
|
+
return "{NodeStartFile};{Handler}";
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
mockery.registerAllowable("../webconfigutil");
|
|
33
|
+
mockery.enable({
|
|
34
|
+
useCleanCache: true,
|
|
35
|
+
warnOnReplace: false,
|
|
36
|
+
warnOnUnregistered: false
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
after(() => {
|
|
40
|
+
mockery.disable();
|
|
41
|
+
});
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
webConfigContents = "";
|
|
44
|
+
});
|
|
45
|
+
it("Should replace substitution parameters", () => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const util = yield Promise.resolve().then(() => require("../webconfigutil"));
|
|
47
|
+
const parameters = {
|
|
48
|
+
NodeStartFile: "server.js",
|
|
49
|
+
Handler: "iisnode"
|
|
50
|
+
};
|
|
51
|
+
util.generateWebConfigFile("web.config", "node", parameters);
|
|
52
|
+
assert.strictEqual(webConfigContents, "server.js;iisnode");
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
exports.runGenerateWebCongigTests = runGenerateWebCongigTests;
|
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
mockery
|
|
3
|
-
useCleanCache: true,
|
|
4
|
-
warnOnReplace: false,
|
|
5
|
-
warnOnUnregistered: false
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
mockery.registerMock('azure-pipelines-task-lib/task', {
|
|
9
|
-
writeFile: function (file, data, options) {
|
|
10
|
-
console.log("web.config contents: " + data);
|
|
11
|
-
},
|
|
12
|
-
debug: function(message: string) {
|
|
13
|
-
console.log("##[debug]: " + message);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
mockery.registerMock('fs', {
|
|
18
|
-
readFileSync: function (path, format) {
|
|
19
|
-
return "{NodeStartFile};{Handler}"
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
var generateWebConfig = require('azure-pipelines-tasks-webdeployment-common/webconfigutil.js');
|
|
24
|
-
generateWebConfig.generateWebConfigFile(
|
|
25
|
-
'node',
|
|
26
|
-
'TemplatePath/node',
|
|
27
|
-
{
|
|
28
|
-
"Handler": "iisnode",
|
|
29
|
-
"NodeStartFile": "server.js"
|
|
30
|
-
}
|
|
31
|
-
);
|
|
1
|
+
import * as assert from "assert";
|
|
2
|
+
import * as mockery from "mockery";
|
|
32
3
|
|
|
4
|
+
|
|
5
|
+
export function runGenerateWebCongigTests() {
|
|
6
|
+
let webConfigContents: string;
|
|
7
|
+
|
|
8
|
+
before(() => {
|
|
9
|
+
|
|
10
|
+
mockery.registerMock('azure-pipelines-task-lib/task', {
|
|
11
|
+
writeFile: function (_file: string, data: string, _options: any): void {
|
|
12
|
+
console.log("web.config contents: " + data);
|
|
13
|
+
webConfigContents = data;
|
|
14
|
+
},
|
|
15
|
+
debug: function(message: string): void {
|
|
16
|
+
console.log("##[debug]: " + message);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
mockery.registerMock('fs', {
|
|
21
|
+
readFileSync: function (_path: string, _format: string): string {
|
|
22
|
+
return "{NodeStartFile};{Handler}"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
mockery.registerAllowable("../webconfigutil");
|
|
27
|
+
|
|
28
|
+
mockery.enable({
|
|
29
|
+
useCleanCache: true,
|
|
30
|
+
warnOnReplace: false,
|
|
31
|
+
warnOnUnregistered: false
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
after(() => {
|
|
36
|
+
mockery.disable();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
webConfigContents = "";
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("Should replace substitution parameters", async () => {
|
|
44
|
+
const util = await import("../webconfigutil");
|
|
45
|
+
const parameters = {
|
|
46
|
+
NodeStartFile: "server.js",
|
|
47
|
+
Handler: "iisnode"
|
|
48
|
+
};
|
|
49
|
+
util.generateWebConfigFile("web.config", "node", parameters);
|
|
50
|
+
assert.strictEqual(webConfigContents, "server.js;iisnode");
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
declare
|
|
2
|
-
declare
|
|
3
|
-
ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER: string;
|
|
4
|
-
"An error was encountered when processing operation 'Delete Directory' on 'D:\\home\\site\\wwwroot\\app_data\\jobs\\continous'": string;
|
|
5
|
-
"Cannot delete file main.dll. Error code: FILE_IN_USE": string;
|
|
6
|
-
"transport connection": string;
|
|
7
|
-
"error code: ERROR_CONNECTION_TERMINATED": string;
|
|
8
|
-
};
|
|
9
|
-
declare function checkParametersIfPresent(argumentString: string, argumentCheckArray: Array<string>): boolean;
|
|
10
|
-
declare var defaultMSBuildPackageArgument: string;
|
|
11
|
-
declare var tokenAuthMSBuildPackageArgument: string;
|
|
12
|
-
declare var packageWithSetParamArgument: string;
|
|
13
|
-
declare var folderPackageArgument: string;
|
|
14
|
-
declare var packageWithExcludeAppDataArgument: string;
|
|
15
|
-
declare var warDeploymentArgument: string;
|
|
16
|
-
declare var overrideRetryArgument: string;
|
|
1
|
+
export declare function runGetMSDeployCmdArgsTests(): void;
|
|
2
|
+
export declare function runGetWebDeployErrorCodeTests(): void;
|