azure-pipelines-task-lib 4.12.1 → 4.13.0
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.js +26 -31
- package/package.json +1 -1
package/mock-test.js
CHANGED
|
@@ -210,23 +210,20 @@ var MockTestRunner = /** @class */ (function () {
|
|
|
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 () {
|
|
213
|
-
var version, downloadVersion, downloadDestination, pathToExe, result;
|
|
213
|
+
var version, versions, downloadVersion, downloadDestination, pathToExe, result;
|
|
214
214
|
return __generator(this, function (_a) {
|
|
215
215
|
switch (_a.label) {
|
|
216
216
|
case 0:
|
|
217
217
|
version = nodeVersion || this.getNodeVersion();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
break;
|
|
228
|
-
default:
|
|
229
|
-
throw new Error('Invalid node version, must be 6, 10, or 16 (received ' + version + ')');
|
|
218
|
+
versions = {
|
|
219
|
+
20: 'v20.13.1',
|
|
220
|
+
16: 'v16.20.2',
|
|
221
|
+
10: 'v10.24.1',
|
|
222
|
+
6: 'v6.17.1',
|
|
223
|
+
};
|
|
224
|
+
downloadVersion = versions[version];
|
|
225
|
+
if (!downloadVersion) {
|
|
226
|
+
throw new Error('Invalid node version, must be 6, 10, 16 or 20 (received ' + version + ')');
|
|
230
227
|
}
|
|
231
228
|
downloadDestination = path.join(downloadDirectory, 'node' + version);
|
|
232
229
|
pathToExe = this.getPathToNodeExe(downloadVersion, downloadDestination);
|
|
@@ -249,29 +246,27 @@ var MockTestRunner = /** @class */ (function () {
|
|
|
249
246
|
}
|
|
250
247
|
var taskJsonContents = fs.readFileSync(taskJsonPath, { encoding: 'utf-8' });
|
|
251
248
|
var taskJson = JSON.parse(taskJsonContents);
|
|
252
|
-
var
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
else if (keys[i].toLowerCase() == 'node') {
|
|
267
|
-
nodeVersionFound = true;
|
|
249
|
+
var nodeVersion = 0;
|
|
250
|
+
var executors = ['execution', 'prejobexecution', 'postjobexecution'];
|
|
251
|
+
for (var _i = 0, executors_1 = executors; _i < executors_1.length; _i++) {
|
|
252
|
+
var executor = executors_1[_i];
|
|
253
|
+
if (!taskJson[executor])
|
|
254
|
+
continue;
|
|
255
|
+
for (var _a = 0, _b = Object.keys(taskJson[executor]); _a < _b.length; _a++) {
|
|
256
|
+
var key = _b[_a];
|
|
257
|
+
var currExecutor = key.toLocaleLowerCase();
|
|
258
|
+
if (!currExecutor.startsWith('node'))
|
|
259
|
+
continue;
|
|
260
|
+
var version = currExecutor.replace('node', '');
|
|
261
|
+
var intVersion = parseInt(version) || 6; // node handler is node v6 by default
|
|
262
|
+
nodeVersion = Math.max(intVersion, nodeVersion);
|
|
268
263
|
}
|
|
269
264
|
}
|
|
270
|
-
if (
|
|
265
|
+
if (nodeVersion === 0) {
|
|
271
266
|
console.warn('Unable to determine execution type from task.json, defaulting to use Node 16');
|
|
272
267
|
return 16;
|
|
273
268
|
}
|
|
274
|
-
return
|
|
269
|
+
return nodeVersion;
|
|
275
270
|
};
|
|
276
271
|
// Returns the path to the task.json for the task being tested. Returns null if unable to find it.
|
|
277
272
|
// Searches by moving up the directory structure from the initial starting point and checking at each level.
|