@@ -51,6 +51,17 @@ class MarkdownReporter implements Reporter {
5151 async onEnd ( result : FullResult ) {
5252 const summary = this . _generateSummary ( ) ;
5353 const lines : string [ ] = [ ] ;
54+ if ( this . _options . shardDurationThreshold && result . shards ) {
55+ for ( const shard of result . shards ) {
56+ if ( shard . duration > this . _options . shardDurationThreshold ) {
57+ const shardLabel = shard . shardIndex !== undefined ? `Shard ${ shard . shardIndex } ` : 'Shard' ;
58+ const durationMins = Math . round ( shard . duration / 60000 ) ;
59+ const thresholdMins = Math . round ( this . _options . shardDurationThreshold / 60000 ) ;
60+ lines . push ( `:warning: **Warning: ${ shardLabel } took ${ durationMins } minutes, exceeding the ${ thresholdMins } minute threshold.**` ) ;
61+ lines . push ( `` ) ;
62+ }
63+ }
64+ }
5465 if ( this . _fatalErrors . length )
5566 lines . push ( `**${ this . _fatalErrors . length } fatal errors, not part of any test**` ) ;
5667 if ( summary . unexpected . length ) {
@@ -76,18 +87,6 @@ class MarkdownReporter implements Reporter {
7687 lines . push ( `**${ summary . expected } passed${ skipped } ${ didNotRun } **` ) ;
7788 lines . push ( `` ) ;
7889
79- if ( this . _options . shardDurationThreshold && result . shards ) {
80- for ( const shard of result . shards ) {
81- if ( shard . duration > this . _options . shardDurationThreshold ) {
82- const shardLabel = shard . shardIndex !== undefined ? `Shard ${ shard . shardIndex } ` : 'Shard' ;
83- const durationMins = Math . round ( shard . duration / 60000 ) ;
84- const thresholdMins = Math . round ( this . _options . shardDurationThreshold / 60000 ) ;
85- lines . push ( `:warning: **Warning: ${ shardLabel } took ${ durationMins } minutes, exceeding the ${ thresholdMins } minute threshold.**` ) ;
86- lines . push ( `` ) ;
87- }
88- }
89- }
90-
9190 await this . publishReport ( lines . join ( '\n' ) ) ;
9291 }
9392
0 commit comments