Skip to content

Commit 8ad1bb6

Browse files
Change run to runAsync in Nuget tasks (#21102)
* Fix run to runAsync in Nuget tasks * Add dependencies to tasks * Update versions to 260
1 parent 640a407 commit 8ad1bb6

File tree

12 files changed

+875
-40
lines changed

12 files changed

+875
-40
lines changed

Tasks/NuGetPublisherV0/Tests/.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
scripts-prepend-node-path=true
2+
3+
registry=https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/
4+
5+
always-auth=true

Tasks/NuGetPublisherV0/Tests/L0.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
import * as path from 'path';
22
import * as assert from 'assert';
3+
34
import * as ttm from 'azure-pipelines-task-lib/mock-test';
45

56
describe('NuGetPublisher Suite', function () {
6-
before(() => {
7-
});
8-
9-
after(() => {
10-
});
11-
12-
it('publish single package internally', (done: MochaDone) => {
13-
let tp = path.join(__dirname, 'internal.js')
14-
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
15-
16-
tr.run()
7+
it('publish single package internally', async () => {
8+
const tp = path.join(__dirname, 'internal.js')
9+
const tr = new ttm.MockTestRunner(tp);
10+
await tr.runAsync()
1711
assert(tr.ran('c:\\from\\tool\\installer\\nuget.exe push -NonInteractive c:\\agent\\home\\directory\\package.nupkg -Source testFeedUri -ApiKey VSTS -ConfigFile c:\\agent\\home\\directory\\tempNuGet_.config'), 'should have pushed packages');
1812
assert(tr.stdOutContained('setting console code page'), 'it should have run chcp');
1913
assert(tr.stdOutContained('NuGet output here'), "should have nuget output");
2014
assert(tr.succeeded, 'should have succeeded');
21-
assert(tr.invokedToolCount == 1, 'should have run NuGet');
15+
assert(tr.invokedToolCount == 1, 'should have run NuGet');
2216
assert.equal(tr.warningIssues.length, 0, "should have no warnings");
2317
assert.equal(tr.errorIssues.length, 0, "should have no errors");
24-
done();
2518
}).timeout(20000);
26-
27-
it('publish single package externally', (done: MochaDone) => {
28-
let tp = path.join(__dirname, 'external.js')
29-
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
3019

31-
tr.run()
20+
it('publish single package externally', async () => {
21+
const tp = path.join(__dirname, 'external.js')
22+
const tr = new ttm.MockTestRunner(tp);
23+
await tr.runAsync()
3224
assert(tr.ran('c:\\from\\tool\\installer\\nuget.exe push -NonInteractive c:\\agent\\home\\directory\\package.nupkg -Source https://example.feed.com -ApiKey secret'), 'should have pushed packages');
3325
assert(tr.stdOutContained('setting console code page'), 'it should have run chcp');
3426
assert(tr.stdOutContained('NuGet output here'), "should have nuget output");
@@ -37,6 +29,5 @@ describe('NuGetPublisher Suite', function () {
3729
assert(tr.invokedToolCount == 1, 'should have run NuGet');
3830
assert.equal(tr.warningIssues.length, 0, "should have no warnings");
3931
assert.equal(tr.errorIssues.length, 0, "should have no errors");
40-
done();
4132
}).timeout(20000);
4233
});

0 commit comments

Comments
 (0)