@@ -123,11 +123,19 @@ const tests = allTests.filter((name) => {
123123const testsToRun = tests . filter ( ( name , i ) => shardId === null || i % nbShards == shardId ) ;
124124
125125if ( testsToRun . length === 0 ) {
126- console . log ( `No tests would be ran, aborting.` ) ;
127- process . exit ( 1 ) ;
126+ if ( shardId !== null && tests . length >= shardId ? 1 : 0 ) {
127+ console . log ( `No tests to run on shard ${ shardId } , exiting.` ) ;
128+ process . exit ( 0 ) ;
129+ } else {
130+ console . log ( `No tests would be ran, aborting.` ) ;
131+ process . exit ( 1 ) ;
132+ }
133+ }
134+
135+ if ( shardId !== null ) {
136+ console . log ( `Running shard ${ shardId } of ${ nbShards } ` ) ;
128137}
129138
130- console . log ( testsToRun . join ( '\n' ) ) ;
131139/**
132140 * Load all the files from the e2e, filter and sort them and build a promise of their default
133141 * export.
@@ -138,6 +146,8 @@ if (testsToRun.length == allTests.length) {
138146 console . log ( `Running ${ testsToRun . length } tests (${ allTests . length } total)` ) ;
139147}
140148
149+ console . log ( [ 'Tests:' , ...testsToRun ] . join ( '\n ' ) ) ;
150+
141151setGlobalVariable ( 'argv' , argv ) ;
142152setGlobalVariable ( 'ci' , process . env [ 'CI' ] ?. toLowerCase ( ) === 'true' || process . env [ 'CI' ] === '1' ) ;
143153setGlobalVariable ( 'package-manager' , argv . yarn ? 'yarn' : 'npm' ) ;
@@ -156,14 +166,20 @@ Promise.all([findFreePort(), findFreePort()])
156166 await runSteps ( runInitializer , allInitializers , 'initializer' ) ;
157167 await runSteps ( runTest , testsToRun , 'test' ) ;
158168
159- console . log ( colors . green ( 'Done.' ) ) ;
169+ if ( shardId !== null ) {
170+ console . log ( colors . green ( `Done shard ${ shardId } of ${ nbShards } .` ) ) ;
171+ } else {
172+ console . log ( colors . green ( 'Done.' ) ) ;
173+ }
160174 } catch ( err ) {
161175 if ( err instanceof Error ) {
162176 console . log ( '\n' ) ;
163177 console . error ( colors . red ( err . message ) ) ;
164178 if ( err . stack ) {
165179 console . error ( colors . red ( err . stack ) ) ;
166180 }
181+ } else {
182+ console . error ( colors . red ( String ( err ) ) ) ;
167183 }
168184
169185 if ( argv . debug ) {
@@ -192,6 +208,8 @@ async function runSteps(
192208 steps : string [ ] ,
193209 type : 'setup' | 'test' | 'initializer' ,
194210) {
211+ const capsType = type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) ;
212+
195213 for ( const [ stepIndex , relativeName ] of steps . entries ( ) ) {
196214 // Make sure this is a windows compatible path.
197215 let absoluteName = path . join ( e2eRoot , relativeName ) . replace ( / \. t s $ / , '' ) ;
@@ -210,7 +228,8 @@ async function runSteps(
210228 await run ( absoluteName ) ;
211229 } catch ( e ) {
212230 console . log ( '\n' ) ;
213- console . error ( colors . red ( `Step "${ absoluteName } " failed...` ) ) ;
231+ console . error ( colors . red ( `${ capsType } "${ name } " failed...` ) ) ;
232+
214233 throw e ;
215234 } finally {
216235 logStack . pop ( ) ;
@@ -272,8 +291,14 @@ function printHeader(
272291}
273292
274293function printFooter ( testName : string , type : 'setup' | 'initializer' | 'test' , startTime : number ) {
294+ const capsType = type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) ;
295+
275296 // Round to hundredth of a second.
276297 const t = Math . round ( ( Date . now ( ) - startTime ) / 10 ) / 100 ;
277- console . log ( colors . green ( `Last ${ type } took ` ) + colors . bold . blue ( '' + t ) + colors . green ( 's...' ) ) ;
298+ console . log (
299+ colors . green ( `${ capsType } "${ colors . bold . blue ( testName ) } " took ` ) +
300+ colors . bold . blue ( '' + t ) +
301+ colors . green ( 's...' ) ,
302+ ) ;
278303 console . log ( '' ) ;
279304}
0 commit comments