@@ -123,11 +123,19 @@ const tests = allTests.filter((name) => {
123
123
const testsToRun = tests . filter ( ( name , i ) => shardId === null || i % nbShards == shardId ) ;
124
124
125
125
if ( 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 } ` ) ;
128
137
}
129
138
130
- console . log ( testsToRun . join ( '\n' ) ) ;
131
139
/**
132
140
* Load all the files from the e2e, filter and sort them and build a promise of their default
133
141
* export.
@@ -138,6 +146,8 @@ if (testsToRun.length == allTests.length) {
138
146
console . log ( `Running ${ testsToRun . length } tests (${ allTests . length } total)` ) ;
139
147
}
140
148
149
+ console . log ( [ 'Tests:' , ...testsToRun ] . join ( '\n ' ) ) ;
150
+
141
151
setGlobalVariable ( 'argv' , argv ) ;
142
152
setGlobalVariable ( 'ci' , process . env [ 'CI' ] ?. toLowerCase ( ) === 'true' || process . env [ 'CI' ] === '1' ) ;
143
153
setGlobalVariable ( 'package-manager' , argv . yarn ? 'yarn' : 'npm' ) ;
@@ -156,14 +166,20 @@ Promise.all([findFreePort(), findFreePort()])
156
166
await runSteps ( runInitializer , allInitializers , 'initializer' ) ;
157
167
await runSteps ( runTest , testsToRun , 'test' ) ;
158
168
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
+ }
160
174
} catch ( err ) {
161
175
if ( err instanceof Error ) {
162
176
console . log ( '\n' ) ;
163
177
console . error ( colors . red ( err . message ) ) ;
164
178
if ( err . stack ) {
165
179
console . error ( colors . red ( err . stack ) ) ;
166
180
}
181
+ } else {
182
+ console . error ( colors . red ( String ( err ) ) ) ;
167
183
}
168
184
169
185
if ( argv . debug ) {
@@ -192,6 +208,8 @@ async function runSteps(
192
208
steps : string [ ] ,
193
209
type : 'setup' | 'test' | 'initializer' ,
194
210
) {
211
+ const capsType = type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) ;
212
+
195
213
for ( const [ stepIndex , relativeName ] of steps . entries ( ) ) {
196
214
// Make sure this is a windows compatible path.
197
215
let absoluteName = path . join ( e2eRoot , relativeName ) . replace ( / \. t s $ / , '' ) ;
@@ -210,7 +228,8 @@ async function runSteps(
210
228
await run ( absoluteName ) ;
211
229
} catch ( e ) {
212
230
console . log ( '\n' ) ;
213
- console . error ( colors . red ( `Step "${ absoluteName } " failed...` ) ) ;
231
+ console . error ( colors . red ( `${ capsType } "${ name } " failed...` ) ) ;
232
+
214
233
throw e ;
215
234
} finally {
216
235
logStack . pop ( ) ;
@@ -272,8 +291,14 @@ function printHeader(
272
291
}
273
292
274
293
function printFooter ( testName : string , type : 'setup' | 'initializer' | 'test' , startTime : number ) {
294
+ const capsType = type [ 0 ] . toUpperCase ( ) + type . slice ( 1 ) ;
295
+
275
296
// Round to hundredth of a second.
276
297
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
+ ) ;
278
303
console . log ( '' ) ;
279
304
}
0 commit comments