Skip to content

Commit d54de00

Browse files
Migrate NuGetCommandV2 to NodeJS10 (#16826)
* Migrate NuGetCommandV2 to NodeJS10 * task versino bump * fixing errors * fix cloud build * update * test cases fix! * fix * replace deprecated method * try to fix test cases timeout * removing first test case to see the behavior * try to fix * changed the timeout from 10000 back to 1000 * removing commons in make.json
1 parent 0cd32d9 commit d54de00

15 files changed

+841
-447
lines changed

Tasks/NuGetCommandV2/Common/VstsNuGetPushToolRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as tl from "azure-pipelines-task-lib/task";
22
import {IExecOptions, IExecSyncResult, ToolRunner} from "azure-pipelines-task-lib/toolrunner";
3-
import * as auth from "packaging-common/nuget/Authentication";
3+
import * as auth from "azure-pipelines-tasks-packaging-common-v3/nuget/Authentication";
44

55
export interface VstsNuGetPushSettings {
66
continueOnConflict: boolean;

Tasks/NuGetCommandV2/Common/VstsNuGetPushToolUtilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Placed as a separate file for the purpose of unit testing
22
import * as path from "path";
3-
import * as commandHelper from "packaging-common/nuget/CommandHelper";
3+
import * as commandHelper from "azure-pipelines-tasks-packaging-common-v3/nuget/CommandHelper";
44

55
export function getBundledVstsNuGetPushLocation(): string {
66
const vstsNuGetPushPaths: string[] = ["VstsNuGetPush/0.19.0/tools"];

Tasks/NuGetCommandV2/Tests/L0.ts

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('NuGetCommand Suite', function () {
99
after(() => {
1010
});
1111

12-
it('restore single solution', (done: MochaDone) => {
12+
it('restore single solution', (done: Mocha.Done) => {
1313
this.timeout(1000);
1414

1515
let tp = path.join(__dirname, './RestoreTests/singlesln.js')
@@ -23,9 +23,9 @@ describe('NuGetCommand Suite', function () {
2323
assert(tr.succeeded, 'should have succeeded');
2424
assert.equal(tr.errorIssues.length, 0, "should have no errors");
2525
done();
26-
});
26+
}).timeout(20000);
2727

28-
it('restore single solution with CredentialProvider', (done: MochaDone) => {
28+
it('restore single solution with CredentialProvider', (done: Mocha.Done) => {
2929
this.timeout(1000);
3030

3131
let tp = path.join(__dirname, './RestoreTests/singleslnCredentialProvider.js')
@@ -43,7 +43,7 @@ describe('NuGetCommand Suite', function () {
4343
done();
4444
});
4545

46-
it('restore packages.config', (done: MochaDone) => {
46+
it('restore packages.config', (done: Mocha.Done) => {
4747
this.timeout(1000);
4848

4949
let tp = path.join(__dirname, './RestoreTests/pkgconfig.js')
@@ -59,7 +59,7 @@ describe('NuGetCommand Suite', function () {
5959
done();
6060
});
6161

62-
it('restore single solution with noCache', (done: MochaDone) => {
62+
it('restore single solution with noCache', (done: Mocha.Done) => {
6363
this.timeout(1000);
6464

6565
let tp = path.join(__dirname, './RestoreTests/singleslnNoCache.js')
@@ -75,7 +75,7 @@ describe('NuGetCommand Suite', function () {
7575
done();
7676
});
7777

78-
it('restore single solution with disableParallelProcessing', (done: MochaDone) => {
78+
it('restore single solution with disableParallelProcessing', (done: Mocha.Done) => {
7979
this.timeout(1000);
8080

8181
let tp = path.join(__dirname, './RestoreTests/singleslnDisableParallelProcessing.js')
@@ -91,7 +91,7 @@ describe('NuGetCommand Suite', function () {
9191
done();
9292
});
9393

94-
it('restore single solution with nuget config', (done: MochaDone) => {
94+
it('restore single solution with nuget config', (done: Mocha.Done) => {
9595
this.timeout(1000);
9696

9797
let tp = path.join(__dirname, './RestoreTests/singleslnConfigFile.js')
@@ -107,7 +107,7 @@ describe('NuGetCommand Suite', function () {
107107
done();
108108
});
109109

110-
it('restore multiple solutions', (done: MochaDone) => {
110+
it('restore multiple solutions', (done: Mocha.Done) => {
111111
this.timeout(1000);
112112

113113
let tp = path.join(__dirname, './RestoreTests/multiplesln.js')
@@ -124,7 +124,7 @@ describe('NuGetCommand Suite', function () {
124124
done();
125125
});
126126

127-
it('restore multiple solutions and parses pattern appropriately', (done: MochaDone) => {
127+
it('restore multiple solutions and parses pattern appropriately', (done: Mocha.Done) => {
128128
this.timeout(1000);
129129

130130
let tp = path.join(__dirname, './RestoreTests/multipleslnmultiplepattern.js')
@@ -141,7 +141,7 @@ describe('NuGetCommand Suite', function () {
141141
done();
142142
});
143143

144-
it('restore single solution mono', (done: MochaDone) => {
144+
it('restore single solution mono', (done: Mocha.Done) => {
145145
this.timeout(1000);
146146

147147
let tp = path.join(__dirname, './RestoreTests/singleslnMono.js')
@@ -156,7 +156,7 @@ describe('NuGetCommand Suite', function () {
156156
done();
157157
});
158158

159-
it('restore select vsts source', (done: MochaDone) => {
159+
it('restore select vsts source', (done: Mocha.Done) => {
160160
this.timeout(1000);
161161

162162
let tp = path.join(__dirname, './RestoreTests/selectSourceVsts.js')
@@ -171,7 +171,7 @@ describe('NuGetCommand Suite', function () {
171171
done();
172172
});
173173

174-
it('restore select nuget.org source', (done: MochaDone) => {
174+
it('restore select nuget.org source', (done: Mocha.Done) => {
175175
this.timeout(1000);
176176

177177
let tp = path.join(__dirname, './RestoreTests/selectSourceNuGetOrg.js')
@@ -186,7 +186,7 @@ describe('NuGetCommand Suite', function () {
186186
done();
187187
});
188188

189-
it('restore select multiple sources', (done: MochaDone) => {
189+
it('restore select multiple sources', (done: Mocha.Done) => {
190190
this.timeout(1000);
191191

192192
let tp = path.join(__dirname, './RestoreTests/selectSourceMultiple.js')
@@ -201,7 +201,7 @@ describe('NuGetCommand Suite', function () {
201201
done();
202202
});
203203

204-
it('pushes successfully to internal feed using NuGet.exe', (done: MochaDone) => {
204+
it('pushes successfully to internal feed using NuGet.exe', (done: Mocha.Done) => {
205205
this.timeout(1000);
206206

207207
let tp = path.join(__dirname, './PublishTests/internalFeedNuGet.js')
@@ -217,7 +217,7 @@ describe('NuGetCommand Suite', function () {
217217
done();
218218
});
219219

220-
it('pushes successfully to internal feed using VstsNuGetPush.exe', (done: MochaDone) => {
220+
it('pushes successfully to internal feed using VstsNuGetPush.exe', (done: Mocha.Done) => {
221221
this.timeout(1000);
222222

223223
let tp = path.join(__dirname, './PublishTests/internalFeedVstsNuGetPush.js')
@@ -233,7 +233,7 @@ describe('NuGetCommand Suite', function () {
233233
done();
234234
});
235235

236-
it('pushes successfully to internal project scoped feed using VstsNuGetPush.exe', (done: MochaDone) => {
236+
it('pushes successfully to internal project scoped feed using VstsNuGetPush.exe', (done: Mocha.Done) => {
237237
this.timeout(1000);
238238

239239
let tp = path.join(__dirname, './PublishTests/internalFeedVstsNuGetPushProjectScoped.js')
@@ -249,7 +249,7 @@ describe('NuGetCommand Suite', function () {
249249
done();
250250
});
251251

252-
it('succeeds when conflict occurs using VstsNuGetPush.exe (allow conflict)', (done: MochaDone) => {
252+
it('succeeds when conflict occurs using VstsNuGetPush.exe (allow conflict)', (done: Mocha.Done) => {
253253
this.timeout(1000);
254254

255255
let tp = path.join(__dirname, './PublishTests/internalFeedVstsNuGetPushAllowConflict.js')
@@ -265,7 +265,7 @@ describe('NuGetCommand Suite', function () {
265265
done();
266266
});
267267

268-
it('succeeds when conflict occurs using NuGet.exe on Linux (allow conflict)', (done: MochaDone) => {
268+
it('succeeds when conflict occurs using NuGet.exe on Linux (allow conflict)', (done: Mocha.Done) => {
269269
this.timeout(1000);
270270

271271
let tp = path.join(__dirname, './PublishTests/failWithContinueOnConflictOnLinux.js')
@@ -279,7 +279,7 @@ describe('NuGetCommand Suite', function () {
279279
done();
280280
});
281281

282-
it('fails when conflict occurs using VstsNuGetPush.exe (disallow conflict)', (done: MochaDone) => {
282+
it('fails when conflict occurs using VstsNuGetPush.exe (disallow conflict)', (done: Mocha.Done) => {
283283
this.timeout(1000);
284284

285285
let tp = path.join(__dirname, './PublishTests/internalFeedVstsNuGetPushDisallowConflict.js')
@@ -294,7 +294,7 @@ describe('NuGetCommand Suite', function () {
294294
done();
295295
});
296296

297-
it('packs with prerelease', (done: MochaDone) => {
297+
it('packs with prerelease', (done: Mocha.Done) => {
298298
this.timeout(1000);
299299

300300
let tp = path.join(__dirname, './PackTests/packPrerelease.js')
@@ -310,7 +310,7 @@ describe('NuGetCommand Suite', function () {
310310
done();
311311
});
312312

313-
it('packs with env var', (done: MochaDone) => {
313+
it('packs with env var', (done: Mocha.Done) => {
314314
this.timeout(1000);
315315

316316
let tp = path.join(__dirname, './PackTests/packEnvVar.js')
@@ -326,7 +326,7 @@ describe('NuGetCommand Suite', function () {
326326
done();
327327
});
328328

329-
it('packs with build number', (done: MochaDone) => {
329+
it('packs with build number', (done: Mocha.Done) => {
330330
this.timeout(1000);
331331

332332
let tp = path.join(__dirname, './PackTests/packBuildNumber.js')
@@ -342,7 +342,7 @@ describe('NuGetCommand Suite', function () {
342342
done();
343343
});
344344

345-
it('packs with base path', (done: MochaDone) => {
345+
it('packs with base path', (done: Mocha.Done) => {
346346
this.timeout(1000);
347347

348348
let tp = path.join(__dirname, './PackTests/packBasePath.js')
@@ -358,7 +358,7 @@ describe('NuGetCommand Suite', function () {
358358
done();
359359
});
360360

361-
it('packs tool', (done: MochaDone) => {
361+
it('packs tool', (done: Mocha.Done) => {
362362
this.timeout(1000);
363363

364364
let tp = path.join(__dirname, './PackTests/packTool.js')
@@ -374,7 +374,7 @@ describe('NuGetCommand Suite', function () {
374374
done();
375375
});
376376

377-
it('works with custom command happy path', (done: MochaDone) => {
377+
it('works with custom command happy path', (done: Mocha.Done) => {
378378
this.timeout(1000);
379379

380380
let tp = path.join(__dirname, './CustomCommandTests/customHappyPath.js')
@@ -390,7 +390,7 @@ describe('NuGetCommand Suite', function () {
390390
done();
391391
});
392392

393-
it('restore single solution with nuget config and multiple service connections', (done: MochaDone) => {
393+
it('restore single solution with nuget config and multiple service connections', (done: Mocha.Done) => {
394394
this.timeout(1000);
395395

396396
let tp = path.join(__dirname, './RestoreTests/multipleServiceConnections.js')
@@ -409,7 +409,7 @@ describe('NuGetCommand Suite', function () {
409409
});
410410

411411

412-
it('custom command fails when exit code !=0', (done: MochaDone) => {
412+
it('custom command fails when exit code !=0', (done: Mocha.Done) => {
413413
this.timeout(1000);
414414

415415
let tp = path.join(__dirname, './CustomCommandTests/customFailPath.js')
@@ -421,7 +421,7 @@ describe('NuGetCommand Suite', function () {
421421
done();
422422
});
423423

424-
it('pack fails when exit code !=0', (done: MochaDone) => {
424+
it('pack fails when exit code !=0', (done: Mocha.Done) => {
425425
this.timeout(1000);
426426

427427
let tp = path.join(__dirname, './PackTests/packFails.js')
@@ -433,7 +433,7 @@ describe('NuGetCommand Suite', function () {
433433
done();
434434
});
435435

436-
it('publish fails when duplicates are skipped and exit code!=[0|2] on Windows_NT', (done: MochaDone) => {
436+
it('publish fails when duplicates are skipped and exit code!=[0|2] on Windows_NT', (done: Mocha.Done) => {
437437
this.timeout(1000);
438438

439439
let tp = path.join(__dirname, './PublishTests/failWithContinueOnConflict.js')
@@ -445,7 +445,7 @@ describe('NuGetCommand Suite', function () {
445445
done();
446446
});
447447

448-
it('publish fails when duplicates are NOT skipped and exit code!=0', (done: MochaDone) => {
448+
it('publish fails when duplicates are NOT skipped and exit code!=0', (done: Mocha.Done) => {
449449
this.timeout(1000);
450450

451451
let tp = path.join(__dirname, './PublishTests/failWithoutContinueOnConflict.js')
@@ -457,7 +457,7 @@ describe('NuGetCommand Suite', function () {
457457
done();
458458
});
459459

460-
it('restore fails when exit code!=0', (done: MochaDone) => {
460+
it('restore fails when exit code!=0', (done: Mocha.Done) => {
461461
this.timeout(1000);
462462

463463
let tp = path.join(__dirname, './RestoreTests/failRestore.js')

Tasks/NuGetCommandV2/Tests/NugetMockHelper.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import tmrm = require('azure-pipelines-task-lib/mock-run');
2-
import VersionInfoVersion from 'packaging-common/pe-parser/VersionInfoVersion'
3-
import {VersionInfo} from 'packaging-common/pe-parser/VersionResource'
4-
import * as nugetPackUtils from "packaging-common/PackUtilities"
2+
import VersionInfoVersion from "azure-pipelines-tasks-packaging-common-v3/pe-parser/VersionInfoVersion"
3+
import {VersionInfo} from 'azure-pipelines-tasks-packaging-common-v3/pe-parser/VersionResource'
4+
import * as nugetPackUtils from "azure-pipelines-tasks-packaging-common-v3/PackUtilities"
55

6-
import * as pkgMock from 'packaging-common/Tests/MockHelper';
7-
import nMockHelper = require('packaging-common/Tests/NuGetMockHelper');
6+
import * as pkgMock from 'azure-pipelines-tasks-packaging-common-v3/Tests/MockHelper';
7+
import nMockHelper = require('azure-pipelines-tasks-packaging-common-v3/Tests/NuGetMockHelper');
88

99
export class NugetMockHelper {
1010
private defaultNugetVersion = '4.0.0';
@@ -32,7 +32,7 @@ export class NugetMockHelper {
3232

3333
public registerNugetVersionMock(productVersion: string, versionInfoVersion: number[]) {
3434
this.registerNugetVersionMockInternal(productVersion, versionInfoVersion);
35-
this.registerMockWithMultiplePaths(['packaging-common/pe-parser', '../pe-parser'], {
35+
this.registerMockWithMultiplePaths(['azure-pipelines-tasks-packaging-common-v3/pe-parser', '../pe-parser'], {
3636
getFileVersionInfoAsync: function(nuGetExePath) {
3737
let result: VersionInfo = { strings: {} };
3838
result.fileVersion = new VersionInfoVersion(versionInfoVersion[0], versionInfoVersion[1], versionInfoVersion[2], versionInfoVersion[3]);
@@ -43,7 +43,7 @@ export class NugetMockHelper {
4343
}
4444

4545
private registerNugetVersionMockInternal(productVersion: string, versionInfoVersion: number[]) {
46-
this.registerMockWithMultiplePaths(['packaging-common/pe-parser/index', '../pe-parser/index'], {
46+
this.registerMockWithMultiplePaths(['azure-pipelines-tasks-packaging-common-v3/pe-parser/index', '../pe-parser/index'], {
4747
getFileVersionInfoAsync: function(nuGetExePath) {
4848
let result: VersionInfo = { strings: {} };
4949
result.fileVersion = new VersionInfoVersion(versionInfoVersion[0], versionInfoVersion[1], versionInfoVersion[2], versionInfoVersion[3]);
@@ -71,7 +71,7 @@ export class NugetMockHelper {
7171
}
7272

7373
public registerNuGetPackUtilsMock(date: Date) {
74-
this.tmr.registerMock("packaging-common/PackUtilities", {
74+
this.tmr.registerMock("azure-pipelines-tasks-packaging-common-v3/PackUtilities", {
7575
getNowDateString: function(timezone: string) {
7676
return nugetPackUtils.getUtcDateString(date);
7777
}
@@ -80,7 +80,7 @@ export class NugetMockHelper {
8080

8181
public registerNugetConfigMock() {
8282
var nchm = require('./NuGetConfigHelper-mock');
83-
this.tmr.registerMock('packaging-common/nuget/NuGetConfigHelper2', nchm);
83+
this.tmr.registerMock('azure-pipelines-tasks-packaging-common-v3/nuget/NuGetConfigHelper2', nchm);
8484
}
8585

8686
public registerToolRunnerMock() {

Tasks/NuGetCommandV2/make.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
{
2-
"common": [
3-
{
4-
"module": "../Common/utility-common",
5-
"type": "node",
6-
"compile": true
7-
},
8-
{
9-
"module": "../Common/packaging-common",
10-
"type": "node",
11-
"compile": true
12-
}
13-
],
142
"rm": [
153
{
164
"items": [

Tasks/NuGetCommandV2/nugetcommandmain.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as path from "path";
22
import * as tl from "azure-pipelines-task-lib/task";
33

4-
import * as nuGetGetter from "packaging-common/nuget/NuGetToolGetter";
5-
import * as peParser from "packaging-common/pe-parser";
6-
import {VersionInfo} from "packaging-common/pe-parser/VersionResource";
7-
import * as telemetry from "utility-common/telemetry";
4+
import * as nuGetGetter from "azure-pipelines-tasks-packaging-common-v3/nuget/NuGetToolGetter";
5+
import * as peParser from "azure-pipelines-tasks-packaging-common-v3/pe-parser";
6+
import {VersionInfo} from "azure-pipelines-tasks-packaging-common-v3/pe-parser/VersionResource";
7+
import * as telemetry from "azure-pipelines-tasks-utility-common/telemetry";
88
import * as nugetCustom from "./nugetcustom";
99
import * as nugetPack from "./nugetpack";
1010
import * as nugetPublish from "./nugetpublisher";

Tasks/NuGetCommandV2/nugetcustom.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import * as auth from "packaging-common/nuget/Authentication";
2-
import * as ngToolRunner from "packaging-common/nuget/NuGetToolRunner2";
3-
import * as nutil from "packaging-common/nuget/Utility";
1+
import * as auth from "azure-pipelines-tasks-packaging-common-v3/nuget/Authentication";
2+
import * as ngToolRunner from "azure-pipelines-tasks-packaging-common-v3/nuget/NuGetToolRunner2";
3+
import * as nutil from "azure-pipelines-tasks-packaging-common-v3/nuget/Utility";
44
import * as tl from "azure-pipelines-task-lib/task";
5-
import { logError } from 'packaging-common/util';
5+
import { logError } from 'azure-pipelines-tasks-packaging-common-v3/util';
66

7-
import peParser = require("packaging-common/pe-parser/index");
8-
import * as pkgLocationUtils from "packaging-common/locationUtilities";
9-
import * as telemetry from "utility-common/telemetry";
7+
import peParser = require("azure-pipelines-tasks-packaging-common-v3/pe-parser/index");
8+
import * as pkgLocationUtils from "azure-pipelines-tasks-packaging-common-v3/locationUtilities";
9+
import * as telemetry from "azure-pipelines-tasks-utility-common/telemetry";
1010
import {IExecSyncResult} from "azure-pipelines-task-lib/toolrunner";
1111

1212
class NuGetExecutionOptions {

0 commit comments

Comments
 (0)