@@ -39,17 +39,16 @@ globalThis.testWorstCaseCountMap ??= new Map();
3939globalThis . dumpJSONResults ??= false ;
4040globalThis . testList ??= undefined ;
4141globalThis . startDelay ??= undefined ;
42-
43- let shouldReport = false ;
42+ globalThis . shouldReport ??= false ;
4443
4544function getIntParam ( urlParams , key ) {
4645 if ( ! urlParams . has ( key ) )
4746 return undefined
4847 const rawValue = urlParams . get ( key ) ;
4948 const value = parseInt ( rawValue ) ;
5049 if ( value <= 0 )
51- throw new Error ( `Expected positive value for ${ key } , but got ${ rawValue } ` )
52- return value
50+ throw new Error ( `Expected positive value for ${ key } , but got ${ rawValue } ` ) ;
51+ return value ;
5352}
5453
5554function getTestListParam ( urlParams , key ) {
@@ -60,16 +59,20 @@ function getTestListParam(urlParams, key) {
6059
6160if ( typeof ( URLSearchParams ) !== "undefined" ) {
6261 const urlParameters = new URLSearchParams ( window . location . search ) ;
63- shouldReport = urlParameters . has ( 'report' ) && urlParameters . get ( 'report' ) . toLowerCase ( ) == 'true' ;
64- globalThis . startDelay = getIntParam ( urlParameters , "startDelay" ) ;
65- if ( shouldReport && ! globalThis . startDelay )
62+ if ( urlParameters . has ( "report" ) )
63+ globalThis . shouldReport = urlParameters . get ( "report" ) . toLowerCase ( ) == "true" ;
64+ if ( urlParameters . has ( "startDelay" ) )
65+ globalThis . startDelay = getIntParam ( urlParameters , "startDelay" ) ;
66+ if ( globalThis . shouldReport && ! globalThis . startDelay )
6667 globalThis . startDelay = 4000 ;
6768 if ( urlParameters . has ( "tag" ) )
6869 globalThis . testList = getTestListParam ( urlParameters , "tag" ) ;
6970 if ( urlParameters . has ( "test" ) )
7071 globalThis . testList = getTestListParam ( urlParameters , "test" ) ;
71- globalThis . testIterationCount = getIntParam ( urlParameters , "iterationCount" ) ;
72- globalThis . testWorstCaseCount = getIntParam ( urlParameters , "worstCaseCount" ) ;
72+ if ( urlParameters . has ( "iterationCount" ) )
73+ globalThis . testIterationCount = getIntParam ( urlParameters , "iterationCount" ) ;
74+ if ( urlParameters . has ( "worstCaseCount" ) )
75+ globalThis . testWorstCaseCount = getIntParam ( urlParameters , "worstCaseCount" ) ;
7376}
7477
7578// Used for the promise representing the current benchmark run.
@@ -549,7 +552,7 @@ class Driver {
549552 if ( ! isInBrowser )
550553 return ;
551554
552- if ( ! shouldReport )
555+ if ( ! globalThis . shouldReport )
553556 return ;
554557
555558 const content = this . resultsJSON ( ) ;
0 commit comments