@@ -109,9 +109,21 @@ groupCIOutput('Test Registry Setup', () => {
109
109
110
110
const recipePaths = glob . sync ( `${ __dirname } /test-applications/*/test-recipe.json` , { absolute : true } ) ;
111
111
112
- let someTestFailed = false ;
112
+ let processShouldExitWithError = false ;
113
113
114
- const recipeResults = recipePaths . map ( recipePath => {
114
+ type TestResult = {
115
+ testName : string ;
116
+ result : 'PASS' | 'FAIL' | 'TIMEOUT' ;
117
+ } ;
118
+
119
+ type RecipeResult = {
120
+ testApplicationName : string ;
121
+ testApplicationPath : string ;
122
+ buildFailed : boolean ;
123
+ testResults : TestResult [ ] ;
124
+ } ;
125
+
126
+ const recipeResults : RecipeResult [ ] = recipePaths . map ( recipePath => {
115
127
type Recipe = {
116
128
testApplicationName : string ;
117
129
buildCommand ?: string ;
@@ -137,15 +149,21 @@ const recipeResults = recipePaths.map(recipePath => {
137
149
console . log ( buildCommandProcess . stderr . replace ( / ^ / gm, '[BUILD OUTPUT] ' ) ) ;
138
150
139
151
if ( buildCommandProcess . status !== 0 ) {
140
- process . exit ( 1 ) ;
152
+ processShouldExitWithError = true ;
153
+
154
+ printCIErrorMessage (
155
+ `Build command in test application "${ recipe . testApplicationName } " (${ path . dirname ( recipePath ) } ) failed!` ,
156
+ ) ;
157
+
158
+ return {
159
+ testApplicationName : recipe . testApplicationName ,
160
+ testApplicationPath : recipePath ,
161
+ buildFailed : true ,
162
+ testResults : [ ] ,
163
+ } ;
141
164
}
142
165
}
143
166
144
- type TestResult = {
145
- testName : string ;
146
- result : 'PASS' | 'FAIL' | 'TIMEOUT' ;
147
- } ;
148
-
149
167
const testResults : TestResult [ ] = recipe . tests . map ( test => {
150
168
console . log (
151
169
`Running E2E test command for test application "${ recipe . testApplicationName } ", test "${ test . testName } "` ,
@@ -165,7 +183,7 @@ const recipeResults = recipePaths.map(recipePath => {
165
183
const error : undefined | ( Error & { code ?: string } ) = testProcessResult . error ;
166
184
167
185
if ( error ?. code === 'ETIMEDOUT' ) {
168
- someTestFailed = true ;
186
+ processShouldExitWithError = true ;
169
187
printCIErrorMessage (
170
188
`Test "${ test . testName } " in test application "${ recipe . testApplicationName } " (${ path . dirname (
171
189
recipePath ,
@@ -176,7 +194,7 @@ const recipeResults = recipePaths.map(recipePath => {
176
194
result : 'TIMEOUT' ,
177
195
} ;
178
196
} else if ( testProcessResult . status !== 0 ) {
179
- someTestFailed = true ;
197
+ processShouldExitWithError = true ;
180
198
printCIErrorMessage (
181
199
`Test "${ test . testName } " in test application "${ recipe . testApplicationName } " (${ path . dirname (
182
200
recipePath ,
@@ -202,6 +220,7 @@ const recipeResults = recipePaths.map(recipePath => {
202
220
return {
203
221
testApplicationName : recipe . testApplicationName ,
204
222
testApplicationPath : recipePath ,
223
+ buildFailed : false ,
205
224
testResults,
206
225
} ;
207
226
} ) ;
@@ -210,10 +229,18 @@ console.log('--------------------------------------');
210
229
console . log ( 'Test Result Summary:' ) ;
211
230
212
231
recipeResults . forEach ( recipeResult => {
213
- console . log ( `● ${ recipeResult . testApplicationName } (${ path . dirname ( recipeResult . testApplicationPath ) } )` ) ;
214
- recipeResult . testResults . forEach ( testResult => {
215
- console . log ( ` ● ${ testResult . result . padEnd ( 7 , ' ' ) } ${ testResult . testName } ` ) ;
216
- } ) ;
232
+ if ( recipeResult . buildFailed ) {
233
+ console . log (
234
+ `● BUILD FAILED - ${ recipeResult . testApplicationName } (${ path . dirname ( recipeResult . testApplicationPath ) } )` ,
235
+ ) ;
236
+ } else {
237
+ console . log (
238
+ `● BUILD SUCCEEDED - ${ recipeResult . testApplicationName } (${ path . dirname ( recipeResult . testApplicationPath ) } )` ,
239
+ ) ;
240
+ recipeResult . testResults . forEach ( testResult => {
241
+ console . log ( ` ● ${ testResult . result . padEnd ( 7 , ' ' ) } ${ testResult . testName } ` ) ;
242
+ } ) ;
243
+ }
217
244
} ) ;
218
245
219
246
groupCIOutput ( 'Cleanup' , ( ) => {
@@ -222,7 +249,7 @@ groupCIOutput('Cleanup', () => {
222
249
console . log ( 'Successfully stopped test registry container' ) ; // Output from command above is not good so we `ignore` it and emit our own
223
250
} ) ;
224
251
225
- if ( someTestFailed ) {
252
+ if ( processShouldExitWithError ) {
226
253
console . log ( 'Not all tests succeeded.' ) ;
227
254
process . exit ( 1 ) ;
228
255
} else {
0 commit comments