azure-pipelines-tasks-webdeployment-common 4.230.1 → 4.230.3

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.
Files changed (39) hide show
  1. package/Tests/L0.d.ts +1 -0
  2. package/Tests/L0.js +25 -0
  3. package/Tests/L0.ts +24 -0
  4. package/Tests/L0CopyDirectory.d.ts +1 -5
  5. package/Tests/L0CopyDirectory.js +89 -51
  6. package/Tests/L0CopyDirectory.ts +93 -55
  7. package/Tests/L0GenerateWebConfig.d.ts +1 -2
  8. package/Tests/L0GenerateWebConfig.js +55 -24
  9. package/Tests/L0GenerateWebConfig.ts +51 -31
  10. package/Tests/L0MSDeployUtility.d.ts +2 -16
  11. package/Tests/L0MSDeployUtility.js +91 -97
  12. package/Tests/L0MSDeployUtility.ts +89 -100
  13. package/Tests/L0ParameterParserUtility.d.ts +1 -0
  14. package/Tests/L0ParameterParserUtility.js +59 -0
  15. package/Tests/L0ParameterParserUtility.ts +65 -0
  16. package/Tests/L1JSONVarSubWithComments.d.ts +1 -1
  17. package/Tests/L1JSONVarSubWithComments.js +30 -46
  18. package/Tests/L1JSONVarSubWithComments.ts +39 -52
  19. package/Tests/L1JsonVarSub.d.ts +1 -1
  20. package/Tests/L1JsonVarSub.js +58 -66
  21. package/Tests/L1JsonVarSub.ts +67 -66
  22. package/Tests/L1JsonVarSubV2.d.ts +1 -1
  23. package/Tests/L1JsonVarSubV2.js +82 -93
  24. package/Tests/L1JsonVarSubV2.ts +82 -94
  25. package/Tests/L1ValidateFileEncoding.d.ts +2 -5
  26. package/Tests/L1ValidateFileEncoding.js +52 -65
  27. package/Tests/L1ValidateFileEncoding.ts +61 -77
  28. package/Tests/L1XdtTransform.d.ts +2 -3
  29. package/Tests/L1XdtTransform.js +48 -6
  30. package/Tests/L1XdtTransform.ts +57 -6
  31. package/Tests/L1XmlVarSub.d.ts +2 -3
  32. package/Tests/L1XmlVarSub.js +56 -20
  33. package/Tests/L1XmlVarSub.ts +81 -24
  34. package/ctt/ctt/ctt.exe +0 -0
  35. package/package.json +7 -3
  36. package/packageUtility.js +6 -5
  37. package/utility.js +1 -1
  38. package/webconfigutil.d.ts +3 -1
  39. package/xdttransformationutility.js +1 -1
package/Tests/L0.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/Tests/L0.js ADDED
@@ -0,0 +1,25 @@
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
+ const L0ParameterParserUtility_1 = require("./L0ParameterParserUtility");
13
+ describe('Web deployment common tests', () => {
14
+ describe('GetMSDeployCmdArgs tests', L0MSDeployUtility_1.runGetMSDeployCmdArgsTests);
15
+ describe('GetWebDeployErrorCode tests', L0MSDeployUtility_1.runGetWebDeployErrorCodeTests);
16
+ describe("CopyDirectory tests", L0CopyDirectory_1.runCopyDirectoryTests);
17
+ describe("GenerateWebConfig tests", L0GenerateWebConfig_1.runGenerateWebCongigTests);
18
+ describe("L1XmlVarSub tests", L1XmlVarSub_1.runL1XmlVarSubTests);
19
+ describe("L1XdtTransform tests", L1XdtTransform_1.runL1XdtTransformTests);
20
+ describe("L1JSONVarSubWithComments tests", L1JSONVarSubWithComments_1.runL1JSONVarSubWithCommentsTests);
21
+ describe("L1JsonVarSub tests", L1JsonVarSub_1.runL1JsonVarSubTests);
22
+ describe("L1JsonVarSubV2 tests", L1JsonVarSubV2_1.runL1JsonVarSubV2Tests);
23
+ describe("L1ValidateFileEncoding tests", L1ValidateFileEncoding_1.runL1ValidateFileEncodingTests);
24
+ describe("ParameterParserUtility tests", L0ParameterParserUtility_1.runParameterParserUtilityTests);
25
+ });
package/Tests/L0.ts ADDED
@@ -0,0 +1,24 @@
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
+ import { runParameterParserUtilityTests } from "./L0ParameterParserUtility";
11
+
12
+ describe('Web deployment common tests', () => {
13
+ describe('GetMSDeployCmdArgs tests', runGetMSDeployCmdArgsTests);
14
+ describe('GetWebDeployErrorCode tests', runGetWebDeployErrorCodeTests);
15
+ describe("CopyDirectory tests", runCopyDirectoryTests);
16
+ describe("GenerateWebConfig tests", runGenerateWebCongigTests);
17
+ describe("L1XmlVarSub tests", runL1XmlVarSubTests);
18
+ describe("L1XdtTransform tests", runL1XdtTransformTests);
19
+ describe("L1JSONVarSubWithComments tests", runL1JSONVarSubWithCommentsTests);
20
+ describe("L1JsonVarSub tests", runL1JsonVarSubTests);
21
+ describe("L1JsonVarSubV2 tests", runL1JsonVarSubV2Tests);
22
+ describe("L1ValidateFileEncoding tests", runL1ValidateFileEncodingTests);
23
+ describe("ParameterParserUtility tests", runParameterParserUtilityTests);
24
+ });
@@ -1,5 +1 @@
1
- declare var mockery: any;
2
- declare var fileList: string[];
3
- declare var mkdirPCount: number;
4
- declare var cpfilesCount: number;
5
- declare var utility: any;
1
+ export declare function runCopyDirectoryTests(): void;
@@ -1,55 +1,93 @@
1
- var mockery = require('mockery');
2
- mockery.enable({
3
- useCleanCache: true,
4
- warnOnReplace: false,
5
- warnOnUnregistered: false
6
- });
7
- var fileList = ["C:/vinca/path", "C:/vinca/path/myfile.txt",
8
- "C:/vinca/path/New Folder", "C:/vinca/path/New Folder/Another New Folder",
9
- "C:/vinca/New Folder/anotherfile.py", "C:/vinca/New Folder/Another New Folder/mynewfile.txt"];
10
- var mkdirPCount = 0;
11
- var cpfilesCount = 0;
12
- mockery.registerMock('azure-pipelines-task-lib/task', {
13
- exist: function (path) {
14
- console.log("exist : " + path);
15
- },
16
- find: function (path) {
17
- console.log("find : " + path);
18
- return fileList;
19
- },
20
- mkdirP: function (path) {
21
- mkdirPCount += 1;
22
- console.log("mkdirp : " + path);
23
- },
24
- cp: function (source, dest, options, continueOnError) {
25
- if (fileList.indexOf(source) != -1) {
26
- cpfilesCount += 1;
27
- console.log('cp ' + source + ' to ' + dest);
28
- }
29
- },
30
- stats: function (path) {
31
- return {
32
- isDirectory: function () {
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
- return true;
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
- debug: function (message) {
41
- console.log(message);
42
- }
43
- });
44
- var utility = require('azure-pipelines-tasks-webdeployment-common/utility.js');
45
- utility.copyDirectory('C:/vinca/path', 'C:/vinca/path/destFolder');
46
- if (cpfilesCount === 3) {
47
- console.log('## Copy Files Successful ##');
48
- }
49
- /**
50
- * 7 dir to be created including dest dir
51
- * Hash is not created to check already created dir, for testing purpose
52
- */
53
- if (mkdirPCount === 7) {
54
- console.log('## mkdir Successful ##');
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;
@@ -1,59 +1,97 @@
1
- var mockery = require('mockery');
2
- mockery.enable({
3
- useCleanCache: true,
4
- warnOnReplace: false,
5
- warnOnUnregistered: false
6
- });
7
-
8
- var fileList = ["C:/vinca/path", "C:/vinca/path/myfile.txt",
9
- "C:/vinca/path/New Folder", "C:/vinca/path/New Folder/Another New Folder",
10
- "C:/vinca/New Folder/anotherfile.py", "C:/vinca/New Folder/Another New Folder/mynewfile.txt"];
11
-
12
- var mkdirPCount = 0;
13
- var cpfilesCount = 0;
14
- mockery.registerMock('azure-pipelines-task-lib/task', {
15
- exist: function (path) {
16
- console.log("exist : " + path);
17
- },
18
- find: function (path) {
19
- console.log("find : " + path);
20
- return fileList;
21
- },
22
- mkdirP: function (path) {
23
- mkdirPCount += 1;
24
- console.log("mkdirp : " + path);
25
- },
26
- cp: function (source, dest, options, continueOnError) {
27
- if(fileList.indexOf(source)!= -1) {
28
- cpfilesCount += 1;
29
- console.log('cp ' + source + ' to ' + dest);
30
- }
31
- },
32
- stats: function (path) {
33
- return {
34
- isDirectory: function() {
35
- if(path.endsWith('.py') || path.endsWith('.txt')) {
36
- return false;
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
- return true;
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
- debug: function(message) {
43
- console.log(message);
44
- }
45
- });
46
- var utility = require('azure-pipelines-tasks-webdeployment-common/utility.js');
47
- utility.copyDirectory('C:/vinca/path', 'C:/vinca/path/destFolder');
48
-
49
- if(cpfilesCount === 3) {
50
- console.log('## Copy Files Successful ##');
51
- }
52
- /**
53
- * 7 dir to be created including dest dir
54
- * Hash is not created to check already created dir, for testing purpose
55
- */
56
- if(mkdirPCount === 7) {
57
- console.log('## mkdir Successful ##');
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 var mockery: any;
2
- declare var generateWebConfig: any;
1
+ export declare function runGenerateWebCongigTests(): void;
@@ -1,24 +1,55 @@
1
- var mockery = require('mockery');
2
- mockery.enable({
3
- useCleanCache: true,
4
- warnOnReplace: false,
5
- warnOnUnregistered: false
6
- });
7
- mockery.registerMock('azure-pipelines-task-lib/task', {
8
- writeFile: function (file, data, options) {
9
- console.log("web.config contents: " + data);
10
- },
11
- debug: function (message) {
12
- console.log("##[debug]: " + message);
13
- }
14
- });
15
- mockery.registerMock('fs', {
16
- readFileSync: function (path, format) {
17
- return "{NodeStartFile};{Handler}";
18
- }
19
- });
20
- var generateWebConfig = require('azure-pipelines-tasks-webdeployment-common/webconfigutil.js');
21
- generateWebConfig.generateWebConfigFile('node', 'TemplatePath/node', {
22
- "Handler": "iisnode",
23
- "NodeStartFile": "server.js"
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
- var mockery = require('mockery');
2
- mockery.enable({
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 var msdeployUtility: any;
2
- declare var errorMessages: {
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;