@@ -156,6 +156,7 @@ test.serial(
156156 t . assert ( toolcache . find ( "CodeQL" , `0.0.0-${ version } ` ) ) ;
157157 t . is ( result . toolsVersion , `0.0.0-${ version } ` ) ;
158158 t . is ( result . toolsSource , ToolsSource . Download ) ;
159+ assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
159160 }
160161
161162 t . is ( toolcache . findAllVersions ( "CodeQL" ) . length , 2 ) ;
@@ -191,9 +192,7 @@ test.serial(
191192 t . assert ( toolcache . find ( "CodeQL" , `2.15.0` ) ) ;
192193 t . is ( result . toolsVersion , `2.15.0` ) ;
193194 t . is ( result . toolsSource , ToolsSource . Download ) ;
194- if ( result . toolsDownloadStatusReport ) {
195- assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
196- }
195+ assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
197196 } ) ;
198197 } ,
199198) ;
@@ -230,9 +229,7 @@ test.serial(
230229 t . assert ( toolcache . find ( "CodeQL" , "0.0.0-20200610" ) ) ;
231230 t . deepEqual ( result . toolsVersion , "0.0.0-20200610" ) ;
232231 t . is ( result . toolsSource , ToolsSource . Download ) ;
233- if ( result . toolsDownloadStatusReport ) {
234- assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
235- }
232+ assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
236233 } ) ;
237234 } ,
238235) ;
@@ -282,11 +279,7 @@ for (const {
282279 t . assert ( toolcache . find ( "CodeQL" , expectedToolcacheVersion ) ) ;
283280 t . deepEqual ( result . toolsVersion , expectedToolcacheVersion ) ;
284281 t . is ( result . toolsSource , ToolsSource . Download ) ;
285- t . assert (
286- Number . isInteger (
287- result . toolsDownloadStatusReport ?. downloadDurationMs ,
288- ) ,
289- ) ;
282+ assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
290283 } ) ;
291284 } ,
292285 ) ;
@@ -417,9 +410,7 @@ test.serial(
417410 ) ;
418411 t . deepEqual ( result . toolsVersion , defaults . cliVersion ) ;
419412 t . is ( result . toolsSource , ToolsSource . Download ) ;
420- if ( result . toolsDownloadStatusReport ) {
421- assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
422- }
413+ t . truthy ( result . toolsDownloadStatusReport ) ;
423414
424415 const cachedVersions = toolcache . findAllVersions ( "CodeQL" ) ;
425416 t . is ( cachedVersions . length , 2 ) ;
@@ -458,9 +449,7 @@ test.serial(
458449 ) ;
459450 t . deepEqual ( result . toolsVersion , defaults . cliVersion ) ;
460451 t . is ( result . toolsSource , ToolsSource . Download ) ;
461- if ( result . toolsDownloadStatusReport ) {
462- assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
463- }
452+ t . truthy ( result . toolsDownloadStatusReport ) ;
464453
465454 const cachedVersions = toolcache . findAllVersions ( "CodeQL" ) ;
466455 t . is ( cachedVersions . length , 2 ) ;
@@ -502,9 +491,7 @@ test.serial(
502491
503492 t . is ( result . toolsVersion , "0.0.0-20230203" ) ;
504493 t . is ( result . toolsSource , ToolsSource . Download ) ;
505- if ( result . toolsDownloadStatusReport ) {
506- assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
507- }
494+ assertDownloadDurationInteger ( t , result . toolsDownloadStatusReport ) ;
508495
509496 const cachedVersions = toolcache . findAllVersions ( "CodeQL" ) ;
510497 t . is ( cachedVersions . length , 1 ) ;
@@ -517,11 +504,9 @@ test.serial(
517504
518505function assertDownloadDurationInteger (
519506 t : ExecutionContext < unknown > ,
520- statusReport : ToolsDownloadStatusReport ,
507+ statusReport : ToolsDownloadStatusReport | undefined ,
521508) {
522- if ( statusReport . downloadDurationMs !== undefined ) {
523- t . assert ( Number . isInteger ( statusReport . downloadDurationMs ) ) ;
524- }
509+ t . assert ( Number . isInteger ( statusReport ?. downloadDurationMs ) ) ;
525510}
526511
527512test . serial ( "getExtraOptions works for explicit paths" , ( t ) => {
0 commit comments