1
1
import * as path from 'path' ;
2
2
import * as assert from 'assert' ;
3
+
3
4
import * as ttm from 'azure-pipelines-task-lib/mock-test' ;
4
5
5
6
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 ( )
17
11
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' ) ;
18
12
assert ( tr . stdOutContained ( 'setting console code page' ) , 'it should have run chcp' ) ;
19
13
assert ( tr . stdOutContained ( 'NuGet output here' ) , "should have nuget output" ) ;
20
14
assert ( tr . succeeded , 'should have succeeded' ) ;
21
- assert ( tr . invokedToolCount == 1 , 'should have run NuGet' ) ;
15
+ assert ( tr . invokedToolCount == 1 , 'should have run NuGet' ) ;
22
16
assert . equal ( tr . warningIssues . length , 0 , "should have no warnings" ) ;
23
17
assert . equal ( tr . errorIssues . length , 0 , "should have no errors" ) ;
24
- done ( ) ;
25
18
} ) . 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 ) ;
30
19
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 ( )
32
24
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' ) ;
33
25
assert ( tr . stdOutContained ( 'setting console code page' ) , 'it should have run chcp' ) ;
34
26
assert ( tr . stdOutContained ( 'NuGet output here' ) , "should have nuget output" ) ;
@@ -37,6 +29,5 @@ describe('NuGetPublisher Suite', function () {
37
29
assert ( tr . invokedToolCount == 1 , 'should have run NuGet' ) ;
38
30
assert . equal ( tr . warningIssues . length , 0 , "should have no warnings" ) ;
39
31
assert . equal ( tr . errorIssues . length , 0 , "should have no errors" ) ;
40
- done ( ) ;
41
32
} ) . timeout ( 20000 ) ;
42
33
} ) ;
0 commit comments