11import * as path from 'path' ;
22import * as assert from 'assert' ;
3+
34import * as ttm from 'azure-pipelines-task-lib/mock-test' ;
45
56describe ( '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