@@ -543,6 +543,11 @@ export class BenchmarkRunner {
543
543
export class SuiteRunner {
544
544
constructor ( measuredValues , frame , page , client , suite ) {
545
545
// FIXME: Create SuiteRunner-local measuredValues.
546
+ this . _suiteResults = measuredValues . tests [ suite . name ] ;
547
+ if ( ! this . _suiteResults ) {
548
+ this . _suiteResults = { tests : { } , total : 0 } ;
549
+ measuredValues . tests [ suite . name ] = this . _suiteResults ;
550
+ }
546
551
this . _measuredValues = measuredValues ;
547
552
this . _frame = frame ;
548
553
this . _page = page ;
@@ -579,17 +584,16 @@ export class SuiteRunner {
579
584
performance . mark ( suiteEndLabel ) ;
580
585
581
586
performance . measure ( `suite-${ suiteName } ` , suiteStartLabel , suiteEndLabel ) ;
582
- this . _validateSuiteTotal ( suiteName ) ;
587
+ this . _validateSuiteTotal ( ) ;
583
588
}
584
589
585
590
_validateSuiteTotal ( ) {
586
591
// When the test is fast and the precision is low (for example with Firefox'
587
592
// privacy.resistFingerprinting preference), it's possible that the measured
588
593
// total duration for an entire is 0.
589
- const suiteName = this . _suite . name ;
590
- const suiteTotal = this . _measuredValues . tests [ suiteName ] . total ;
594
+ const suiteTotal = this . _suiteResults . total ;
591
595
if ( suiteTotal === 0 )
592
- throw new Error ( `Got invalid 0-time total for suite ${ suiteName } : ${ suiteTotal } ` ) ;
596
+ throw new Error ( `Got invalid 0-time total for suite ${ this . _suite . name } : ${ suiteTotal } ` ) ;
593
597
}
594
598
595
599
async _loadFrame ( ) {
@@ -663,12 +667,10 @@ export class SuiteRunner {
663
667
// Skip reporting updates for the warmup suite.
664
668
if ( this . _suite === WarmupSuite )
665
669
return ;
666
- const suiteName = this . _suite . name ;
667
- const suiteResults = this . _measuredValues . tests [ suiteName ] || { tests : { } , total : 0 } ;
670
+
668
671
const total = syncTime + asyncTime ;
669
- this . _measuredValues . tests [ suiteName ] = suiteResults ;
670
- suiteResults . tests [ test . name ] = { tests : { Sync : syncTime , Async : asyncTime } , total : total } ;
671
- suiteResults . total += total ;
672
+ this . _suiteResults . tests [ test . name ] = { tests : { Sync : syncTime , Async : asyncTime } , total : total } ;
673
+ this . _suiteResults . total += total ;
672
674
673
675
if ( this . _client ?. didRunTest )
674
676
await this . _client . didRunTest ( this . _suite , test ) ;
0 commit comments