azure-pipelines-task-lib 4.12.0 → 4.12.1

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/mock-test.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare class MockTestRunner {
10
10
  succeeded: boolean;
11
11
  errorIssues: string[];
12
12
  warningIssues: string[];
13
- LoadAsync(testPath: string, taskJsonPath?: string): Promise<MockTestRunner>;
13
+ LoadAsync(testPath?: string, taskJsonPath?: string): Promise<MockTestRunner>;
14
14
  get failed(): boolean;
15
15
  ran(cmdline: string): boolean;
16
16
  createdErrorIssue(message: string): boolean;
@@ -18,12 +18,7 @@ export declare class MockTestRunner {
18
18
  stdOutContained(message: string): boolean;
19
19
  stdErrContained(message: string): boolean;
20
20
  runAsync(nodeVersion?: number): Promise<void>;
21
- /**
22
- * @deprecated This method uses library which is not prefered to use on production
23
- */
24
- run(nodeVersion?: number): void;
25
21
  private getNodePath;
26
- private getNodePathSync;
27
22
  private getNodeVersion;
28
23
  private getTaskJsonPath;
29
24
  private downloadNode;
package/mock-test.js CHANGED
@@ -39,12 +39,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.MockTestRunner = void 0;
40
40
  var cp = require("child_process");
41
41
  var fs = require("fs");
42
- var ncp = require("child_process");
43
42
  var os = require("os");
44
43
  var path = require("path");
45
44
  var cmdm = require("./taskcommand");
46
45
  var shelljs = require("shelljs");
47
- var deasync = require("deasync");
48
46
  var Downloader = require("nodejs-file-downloader");
49
47
  var COMMAND_TAG = '[command]';
50
48
  var COMMAND_LENGTH = COMMAND_TAG.length;
@@ -65,7 +63,6 @@ var MockTestRunner = /** @class */ (function () {
65
63
  return;
66
64
  this._taskJsonPath = taskJsonPath || '';
67
65
  this._testPath = testPath;
68
- this.nodePath = this.getNodePathSync();
69
66
  }
70
67
  MockTestRunner.prototype.LoadAsync = function (testPath, taskJsonPath) {
71
68
  return __awaiter(this, void 0, void 0, function () {
@@ -80,8 +77,12 @@ var MockTestRunner = /** @class */ (function () {
80
77
  resolve(this);
81
78
  return [2 /*return*/];
82
79
  }
83
- this._taskJsonPath = taskJsonPath || '';
84
- this._testPath = testPath;
80
+ if (testPath) {
81
+ this._testPath = testPath;
82
+ }
83
+ if (taskJsonPath) {
84
+ this._taskJsonPath = taskJsonPath;
85
+ }
85
86
  _a = this;
86
87
  return [4 /*yield*/, this.getNodePath()];
87
88
  case 1:
@@ -133,8 +134,15 @@ var MockTestRunner = /** @class */ (function () {
133
134
  return [4 /*yield*/, this.getNodePath(nodeVersion)];
134
135
  case 1:
135
136
  nodePath = _a.sent();
136
- _a.label = 2;
137
+ return [3 /*break*/, 4];
137
138
  case 2:
139
+ if (!!nodePath) return [3 /*break*/, 4];
140
+ return [4 /*yield*/, this.getNodePath()];
141
+ case 3:
142
+ nodePath = _a.sent();
143
+ this.nodePath = nodePath;
144
+ _a.label = 4;
145
+ case 4:
138
146
  spawn = cp.spawnSync(nodePath, [this._testPath]);
139
147
  // Clean environment
140
148
  Object.keys(process.env)
@@ -199,14 +207,6 @@ var MockTestRunner = /** @class */ (function () {
199
207
  });
200
208
  });
201
209
  };
202
- /**
203
- * @deprecated This method uses library which is not prefered to use on production
204
- */
205
- MockTestRunner.prototype.run = function (nodeVersion) {
206
- var completeExecution = false;
207
- this.runAsync(nodeVersion).then(function (t) { return completeExecution = true; });
208
- deasync.loopWhile(function () { return !completeExecution; });
209
- };
210
210
  // Returns a path to node.exe with the correct version for this task (based on if its node10 or node)
211
211
  MockTestRunner.prototype.getNodePath = function (nodeVersion) {
212
212
  return __awaiter(this, void 0, void 0, function () {
@@ -240,12 +240,6 @@ var MockTestRunner = /** @class */ (function () {
240
240
  });
241
241
  });
242
242
  };
243
- MockTestRunner.prototype.getNodePathSync = function (nodeVersion) {
244
- var nodePath = '';
245
- this.getNodePath(nodeVersion).then(function (t) { return nodePath = t; });
246
- deasync.loopWhile(function () { return nodePath == ''; });
247
- return nodePath;
248
- };
249
243
  // Determines the correct version of node to use based on the contents of the task's task.json. Defaults to Node 16.
250
244
  MockTestRunner.prototype.getNodeVersion = function () {
251
245
  var taskJsonPath = this.getTaskJsonPath();
@@ -389,7 +383,7 @@ var MockTestRunner = /** @class */ (function () {
389
383
  originalCwd = process.cwd();
390
384
  process.chdir(downloadDestination);
391
385
  try {
392
- ncp.execSync("tar -xzf \"" + path.join(downloadDestination, tarGzName) + "\"");
386
+ cp.execSync("tar -xzf \"" + path.join(downloadDestination, tarGzName) + "\"");
393
387
  }
394
388
  catch (_b) {
395
389
  throw new Error('Failed to unzip node tar.gz from ' + url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-task-lib",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "Azure Pipelines Task SDK",
5
5
  "main": "./task.js",
6
6
  "typings": "./task.d.ts",
@@ -28,7 +28,6 @@
28
28
  "homepage": "https://github.com/Microsoft/azure-pipelines-task-lib",
29
29
  "dependencies": {
30
30
  "adm-zip": "^0.5.10",
31
- "deasync": "^0.1.28",
32
31
  "minimatch": "3.0.5",
33
32
  "nodejs-file-downloader": "^4.11.1",
34
33
  "q": "^1.5.1",