@@ -8,108 +8,100 @@ var isWindows = os.type().match(/^Win/);
8
8
describe ( 'ANT Suite' , function ( ) {
9
9
this . timeout ( parseInt ( process . env . TASK_TEST_TIMEOUT ) || 20000 ) ;
10
10
11
- it ( 'run ANT with all inputs' , ( done ) => {
11
+ it ( 'run ANT with all inputs' , async ( ) => {
12
12
const testPath = path . join ( __dirname , 'L0AllInputs.js' )
13
13
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
14
- runner . run ( ) ;
14
+ await runner . runAsync ( ) ;
15
15
16
16
assert ( runner . ran ( '/usr/local/bin/ANT -version' ) , 'it should have run ANT -version' ) ;
17
17
assert ( runner . ran ( '/usr/local/bin/ANT -buildfile /build/build.xml' ) , 'it should have run ANT -buildfile ...' ) ;
18
18
assert ( runner . invokedToolCount == 2 , 'should have only run ANT 2 times' ) ;
19
19
assert ( runner . stderr . length == 0 , 'should not have written to stderr' ) ;
20
20
assert ( runner . succeeded , 'task should have succeeded' ) ;
21
- done ( ) ;
22
21
} )
23
22
24
- it ( 'fails if missing antBuildFile input' , ( done ) => {
23
+ it ( 'fails if missing antBuildFile input' , async ( ) => {
25
24
const testPath = path . join ( __dirname , 'L0MissingAntBuildFile.js' )
26
25
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
27
- runner . run ( ) ;
26
+ await runner . runAsync ( ) ;
28
27
29
28
assert ( runner . invokedToolCount == 0 , 'should not have run ANT' ) ;
30
29
assert ( runner . failed , 'task should have failed' ) ;
31
30
assert ( runner . stdOutContained ( 'Input required: antBuildFile' ) , 'wrong error message' ) ;
32
- done ( ) ;
33
31
} )
34
32
35
- it ( 'fails if missing javaHomeSelection input' , ( done ) => {
33
+ it ( 'fails if missing javaHomeSelection input' , async ( ) => {
36
34
const testPath = path . join ( __dirname , 'L0MissingJavaHomeSelection.js' )
37
35
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
38
- runner . run ( ) ;
36
+ await runner . runAsync ( ) ;
39
37
40
38
assert ( runner . invokedToolCount == 0 , 'should not have run ANT' ) ;
41
39
assert ( runner . failed , 'task should have failed' ) ;
42
40
assert ( runner . stdOutContained ( 'Input required: javaHomeSelection' ) , 'wrong error message"' ) ;
43
- done ( ) ;
44
41
} )
45
42
46
- it ( 'fails if missing testResultsFiles input' , ( done ) => {
43
+ it ( 'fails if missing testResultsFiles input' , async ( ) => {
47
44
const testPath = path . join ( __dirname , 'L0MissingTestResultsFiles.js' )
48
45
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
49
- runner . run ( ) ;
46
+ await runner . runAsync ( ) ;
50
47
51
48
assert ( runner . invokedToolCount == 0 , 'should not have run ANT' ) ;
52
49
assert ( runner . failed , 'task should have failed' ) ;
53
50
assert ( runner . stdOutContained ( 'Input required: testResultsFiles' ) , 'wrong error message:"' ) ;
54
- done ( ) ;
55
51
} )
56
52
57
- it ( 'run ANT with antHomeUserInputPath' , ( done ) => {
53
+ it ( 'run ANT with antHomeUserInputPath' , async ( ) => {
58
54
const testPath = path . join ( __dirname , 'L0RunWithAntHomeUserInputPath.js' )
59
55
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
60
- runner . run ( ) ;
56
+ await runner . runAsync ( ) ;
61
57
62
58
assert ( runner . ran ( '/usr/local/bin/ANT -version' ) , 'it should have run ANT -version' ) ;
63
59
assert ( runner . ran ( '/usr/local/bin/ANT -buildfile /build/build.xml' ) , 'it should have run ANT -buildfile ...' ) ;
64
60
assert ( runner . invokedToolCount == 2 , 'should have only run ANT 2 times' ) ;
65
61
assert ( runner . stderr . length == 0 , 'should not have written to stderr' ) ;
66
62
assert ( runner . succeeded , 'task should have succeeded' ) ;
67
63
assert ( runner . stdOutContained ( 'Set ANT_HOME to /usr/local/bin/ANT2' ) , 'ANT_HOME not set correctly' ) ;
68
- done ( ) ;
69
64
} )
70
65
71
- it ( 'run ANT with antHomeUserInputPath set to invalid path' , ( done ) => {
66
+ it ( 'run ANT with antHomeUserInputPath set to invalid path' , async ( ) => {
72
67
const testPath = path . join ( __dirname , 'L0InvalidUserHomePath.js' )
73
68
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
74
- runner . run ( ) ;
69
+ await runner . runAsync ( ) ;
75
70
76
71
assert ( runner . invokedToolCount == 0 , 'should not have run ANT' ) ;
77
72
assert ( runner . failed , 'task should have failed' ) ;
78
73
assert ( runner . stdOutContained ( 'Not found /usr/local/bin/ANT_invalid' ) , 'Invalid path not detected' ) ;
79
- done ( ) ;
80
74
} )
81
75
82
- it ( 'run ANT with ANT_HOME not set' , ( done ) => {
76
+ it ( 'run ANT with ANT_HOME not set' , async ( ) => {
83
77
const testPath = path . join ( __dirname , 'L0AntHomeNotSet.js' )
84
78
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
85
- runner . run ( ) ;
79
+ await runner . runAsync ( ) ;
86
80
87
81
// The response file will cause ANT to fail, but we are looking for the warning about ANT_HOME
88
82
assert ( runner . ran ( '/usr/local/bin/ANT -version' ) , 'it should have run ANT -version' ) ;
89
83
assert ( runner . invokedToolCount == 1 , 'should have only run ANT once' ) ;
90
84
assert ( runner . failed , 'task should have failed' ) ;
91
85
assert ( runner . stdOutContained ( 'The ANT_HOME environment variable is not set' ) , 'Missing JAVA_HOME not detected' ) ;
92
- done ( ) ;
93
86
} )
94
87
95
- it ( 'run ANT with jdkVersion set to 1.8' , ( done ) => {
88
+ it ( 'run ANT with jdkVersion set to 1.8' , async ( ) => {
96
89
const testPath = path . join ( __dirname , 'L0JDKSetTo8.js' )
97
90
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
98
- runner . run ( ) ;
91
+ await runner . runAsync ( ) ;
99
92
100
93
assert ( runner . ran ( '/usr/local/bin/ANT -version' ) , 'it should have run ANT -version' ) ;
101
94
assert ( runner . ran ( '/usr/local/bin/ANT -buildfile /build/build.xml' ) , 'it should have run ANT -buildfile ...' ) ;
102
95
assert . strictEqual ( runner . invokedToolCount , 2 , 'should have run ANT 2 times' ) ;
103
96
assert ( runner . stderr . length == 0 , 'should not have written to stderr' ) ;
104
97
assert ( runner . succeeded , 'task should have succeeded' ) ;
105
98
assert ( runner . stdOutContained ( 'Set JAVA_HOME to /user/local/bin/ANT8' ) , 'JAVA_HOME not set correctly' ) ;
106
- done ( ) ;
107
99
} )
108
100
109
- it ( 'run ANT with jdkVersion set to 1.5' , ( done ) => {
101
+ it ( 'run ANT with jdkVersion set to 1.5' , async ( ) => {
110
102
const testPath = path . join ( __dirname , 'L0JDKSetTo5.js' )
111
103
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
112
- runner . run ( ) ;
104
+ await runner . runAsync ( ) ;
113
105
114
106
if ( isWindows ) {
115
107
assert . strictEqual ( runner . invokedToolCount , 1 , 'should have run the reg query toolrunner' ) ;
@@ -118,50 +110,45 @@ describe('ANT Suite', function () {
118
110
}
119
111
assert ( runner . failed , 'task should have failed' ) ;
120
112
assert ( runner . stdOutContained ( 'FailedToLocateSpecifiedJVM' ) , 'Should write FailedToLocateSpecifiedJVM error' ) ;
121
- done ( ) ;
122
113
} )
123
114
124
- it ( 'run ANT valid inputs but it fails' , ( done ) => {
115
+ it ( 'run ANT valid inputs but it fails' , async ( ) => {
125
116
const testPath = path . join ( __dirname , 'L0FailWithValidInputs.js' )
126
117
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
127
- runner . run ( ) ;
118
+ await runner . runAsync ( ) ;
128
119
129
120
// The response file will cause ANT to fail, but we are looking for the warning about ANT_HOME
130
121
assert ( runner . ran ( '/usr/local/bin/ANT -version' ) , 'it should have run ANT -version' ) ;
131
122
assert ( runner . ran ( '/usr/local/bin/ANT -buildfile /build/build.xml' ) , 'it should have run ANT -buildfile ...' ) ;
132
123
assert ( runner . invokedToolCount == 2 , 'should have only run ANT 2 times' ) ;
133
124
assert ( runner . failed , 'task should have failed' ) ;
134
- done ( ) ;
135
125
} )
136
126
137
- it ( 'Ant build with Publish Test Results.' , ( done ) => {
127
+ it ( 'Ant build with Publish Test Results.' , async ( ) => {
138
128
const testPath = path . join ( __dirname , 'L0PublishTestResults.js' )
139
129
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
140
- runner . run ( ) ;
130
+ await runner . runAsync ( ) ;
141
131
142
132
assert ( runner . succeeded , 'The task should not have failed' ) ;
143
- assert ( runner . stdout . search ( / # # v s o \[ r e s u l t s .p u b l i s h t y p e = J U n i t ; m e r g e R e s u l t s = t r u e ; p u b l i s h R u n A t t a c h m e n t s = t r u e ; r e s u l t F i l e s = \/ u s e r \/ b u i l d \/ f u n \/ t e s t - 1 2 3 .x m l ; \] / ) >= 0 )
144
- done ( ) ;
133
+ assert ( runner . stdout . search ( / # # v s o \[ r e s u l t s .p u b l i s h t y p e = J U n i t ; m e r g e R e s u l t s = t r u e ; p u b l i s h R u n A t t a c h m e n t s = t r u e ; r e s u l t F i l e s = \/ u s e r \/ b u i l d \/ f u n \/ t e s t - 1 2 3 .x m l ; \] / ) >= 0 ) ;
145
134
} )
146
135
147
- it ( 'Ant build with Publish Test Results with no matching test result files.' , ( done ) => {
136
+ it ( 'Ant build with Publish Test Results with no matching test result files.' , async ( ) => {
148
137
const testPath = path . join ( __dirname , 'L0NoMatchingTestResults.js' )
149
138
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
150
- runner . run ( ) ;
139
+ await runner . runAsync ( ) ;
151
140
152
141
assert ( runner . stdout . search ( / # # v s o \[ r e s u l t s .p u b l i s h \] / ) < 0 , 'publish test results should have not got called.' ) ;
153
142
assert ( runner . stderr . length == 0 , 'should not have written to stderr' ) ;
154
143
assert ( runner . stdOutContained ( 'NoTestResults' ) , 'should have warned about lack of test results' ) ;
155
144
assert ( runner . succeeded , 'task should have succeeded' ) ;
156
- done ( ) ;
157
145
} )
158
146
159
- it ( 'Ant build with Publish Test Results for failed builds.' , ( done ) => {
147
+ it ( 'Ant build with Publish Test Results for failed builds.' , async ( ) => {
160
148
const testPath = path . join ( __dirname , 'L0FailedBuilds.js' )
161
149
const runner : MockTestRunner = new MockTestRunner ( testPath ) ;
162
- runner . run ( ) ;
150
+ await runner . runAsync ( ) ;
163
151
164
152
assert ( runner . stdout . search ( / # # v s o \[ r e s u l t s .p u b l i s h t y p e = J U n i t ; m e r g e R e s u l t s = t r u e ; p u b l i s h R u n A t t a c h m e n t s = t r u e ; r e s u l t F i l e s = \/ u s e r \/ b u i l d \/ f u n \/ t e s t - 1 2 3 .x m l ; \] / ) >= 0 ) ;
165
- done ( ) ;
166
153
} )
167
154
} ) ;
0 commit comments