@@ -122,15 +122,15 @@ setGlobalVariable('argv', argv);
122
122
setGlobalVariable ( 'ci' , process . env [ 'CI' ] ?. toLowerCase ( ) === 'true' || process . env [ 'CI' ] === '1' ) ;
123
123
setGlobalVariable ( 'package-manager' , argv . yarn ? 'yarn' : 'npm' ) ;
124
124
125
- Promise . all ( [ findFreePort ( ) , findFreePort ( ) ] )
126
- . then ( async ( [ httpPort , httpsPort ] ) => {
127
- setGlobalVariable ( 'package-registry' , 'http://localhost:' + httpPort ) ;
128
- setGlobalVariable ( 'package-secure-registry' , 'http://localhost:' + httpsPort ) ;
125
+ Promise . all ( [ findFreePort ( ) , findFreePort ( ) ] ) . then ( async ( [ httpPort , httpsPort ] ) => {
126
+ setGlobalVariable ( 'package-registry' , 'http://localhost:' + httpPort ) ;
127
+ setGlobalVariable ( 'package-secure-registry' , 'http://localhost:' + httpsPort ) ;
129
128
130
- const registryProcess = await createNpmRegistry ( httpPort , httpPort ) ;
131
- const secureRegistryProcess = await createNpmRegistry ( httpPort , httpsPort , true ) ;
129
+ const registryProcess = await createNpmRegistry ( httpPort , httpPort ) ;
130
+ const secureRegistryProcess = await createNpmRegistry ( httpPort , httpsPort , true ) ;
132
131
133
- return testsToRun
132
+ return (
133
+ testsToRun
134
134
. reduce ( ( previous , relativeName , testIndex ) => {
135
135
// Make sure this is a windows compatible path.
136
136
let absoluteName = path . join ( e2eRoot , relativeName ) ;
@@ -207,35 +207,39 @@ Promise.all([findFreePort(), findFreePort()])
207
207
) ;
208
208
} ) ;
209
209
} , Promise . resolve ( ) )
210
- . finally ( ( ) => {
211
- registryProcess . kill ( ) ;
212
- secureRegistryProcess . kill ( ) ;
213
- } ) ;
214
- } )
215
- . then (
216
- ( ) => {
217
- console . log ( colors . green ( 'Done.' ) ) ;
218
- process . exit ( 0 ) ;
219
- } ,
220
- ( err ) => {
221
- console . log ( '\n' ) ;
222
- console . error ( colors . red ( `Test "${ currentFileName } " failed...` ) ) ;
223
- console . error ( colors . red ( err . message ) ) ;
224
- console . error ( colors . red ( err . stack ) ) ;
210
+ // Output success vs failure information.
211
+ . then (
212
+ ( ) => console . log ( colors . green ( 'Done.' ) ) ,
213
+ ( err ) => {
214
+ console . log ( '\n' ) ;
215
+ console . error ( colors . red ( `Test "${ currentFileName } " failed...` ) ) ;
216
+ console . error ( colors . red ( err . message ) ) ;
217
+ console . error ( colors . red ( err . stack ) ) ;
225
218
226
- if ( argv . debug ) {
227
- console . log ( `Current Directory: ${ process . cwd ( ) } ` ) ;
228
- console . log ( 'Will loop forever while you debug... CTRL-C to quit.' ) ;
219
+ if ( argv . debug ) {
220
+ console . log ( `Current Directory: ${ process . cwd ( ) } ` ) ;
221
+ console . log ( 'Will loop forever while you debug... CTRL-C to quit.' ) ;
229
222
230
- /* eslint-disable no-constant-condition */
231
- while ( 1 ) {
232
- // That's right!
233
- }
234
- }
223
+ /* eslint-disable no-constant-condition */
224
+ while ( 1 ) {
225
+ // That's right!
226
+ }
227
+ }
235
228
236
- process . exit ( 1 ) ;
237
- } ,
229
+ return Promise . reject ( err ) ;
230
+ } ,
231
+ )
232
+ // Kill the registry processes before exiting.
233
+ . finally ( ( ) => {
234
+ registryProcess . kill ( ) ;
235
+ secureRegistryProcess . kill ( ) ;
236
+ } )
237
+ . then (
238
+ ( ) => process . exit ( 0 ) ,
239
+ ( ) => process . exit ( 1 ) ,
240
+ )
238
241
) ;
242
+ } ) ;
239
243
240
244
function printHeader ( testName : string , testIndex : number ) {
241
245
const text = `${ testIndex + 1 } of ${ testsToRun . length } ` ;
0 commit comments