1
1
import yargs from "yargs" ;
2
2
import {
3
3
BenchmarkOptions ,
4
- BENCHMARK_RUNNER ,
4
+ BenchmarkRunner ,
5
5
config ,
6
6
ErrorAndWarning ,
7
7
FrameworkData ,
@@ -21,7 +21,7 @@ import {
21
21
} from "./benchmarksCommon.js" ;
22
22
import { StartupBenchmarkResult } from "./benchmarksLighthouse.js" ;
23
23
import { writeResults } from "./writeResults.js" ;
24
- import { PlausibilityCheck , parseCPUTrace } from "./timeline.js" ;
24
+ import { PlausibilityCheck } from "./timeline.js" ;
25
25
26
26
function forkAndCallBenchmark (
27
27
framework : FrameworkData ,
@@ -32,13 +32,13 @@ function forkAndCallBenchmark(
32
32
let forkedRunner = null ;
33
33
if ( benchmarkInfo . type === BenchmarkType . STARTUP_MAIN ) {
34
34
forkedRunner = "dist/forkedBenchmarkRunnerLighthouse.js" ;
35
- } else if ( config . BENCHMARK_RUNNER == BENCHMARK_RUNNER . WEBDRIVER_CDP ) {
35
+ } else if ( config . BENCHMARK_RUNNER == BenchmarkRunner . WEBDRIVER_CDP ) {
36
36
forkedRunner = "dist/forkedBenchmarkRunnerWebdriverCDP.js" ;
37
- } else if ( config . BENCHMARK_RUNNER == BENCHMARK_RUNNER . PLAYWRIGHT ) {
37
+ } else if ( config . BENCHMARK_RUNNER == BenchmarkRunner . PLAYWRIGHT ) {
38
38
forkedRunner = "dist/forkedBenchmarkRunnerPlaywright.js" ;
39
- } else if ( config . BENCHMARK_RUNNER == BENCHMARK_RUNNER . WEBDRIVER ) {
39
+ } else if ( config . BENCHMARK_RUNNER == BenchmarkRunner . WEBDRIVER ) {
40
40
forkedRunner = "dist/forkedBenchmarkRunnerWebdriver.js" ;
41
- } else if ( config . BENCHMARK_RUNNER == BENCHMARK_RUNNER . WEBDRIVER_AFTERFRAME ) {
41
+ } else if ( config . BENCHMARK_RUNNER == BenchmarkRunner . WEBDRIVER_AFTERFRAME ) {
42
42
forkedRunner = "dist/forkedBenchmarkRunnerWebdriverAfterframe.js" ;
43
43
} else {
44
44
forkedRunner = "dist/forkedBenchmarkRunnerPuppeteer.js" ;
@@ -126,6 +126,7 @@ async function runBenchmakLoop(
126
126
framework : FrameworkData ,
127
127
benchmarkInfo : CPUBenchmarkInfo | MemBenchmarkInfo ,
128
128
benchmarkOptions : BenchmarkOptions ,
129
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
129
130
plausibilityCheck : PlausibilityCheck
130
131
) : Promise < { errors : string [ ] ; warnings : string [ ] } > {
131
132
let warnings : string [ ] = [ ] ;
@@ -240,7 +241,7 @@ async function runBench(
240
241
warnings = warnings . concat ( result . warnings ) ;
241
242
} catch ( e ) {
242
243
console . log ( "UNHANDELED ERROR" , e ) ;
243
- errors . push ( e ) ;
244
+ errors . push ( e as string ) ;
244
245
}
245
246
}
246
247
}
@@ -300,21 +301,21 @@ console.log("args", args);
300
301
let runner = args . runner ;
301
302
if (
302
303
[
303
- BENCHMARK_RUNNER . WEBDRIVER_CDP ,
304
- BENCHMARK_RUNNER . WEBDRIVER ,
305
- BENCHMARK_RUNNER . WEBDRIVER_AFTERFRAME ,
306
- BENCHMARK_RUNNER . PLAYWRIGHT ,
307
- BENCHMARK_RUNNER . PUPPETEER ,
304
+ BenchmarkRunner . WEBDRIVER_CDP ,
305
+ BenchmarkRunner . WEBDRIVER ,
306
+ BenchmarkRunner . WEBDRIVER_AFTERFRAME ,
307
+ BenchmarkRunner . PLAYWRIGHT ,
308
+ BenchmarkRunner . PUPPETEER ,
308
309
] . includes ( runner )
309
310
) {
310
311
console . log ( `INFO: Using ${ runner } benchmark runner` ) ;
311
312
config . BENCHMARK_RUNNER = runner ;
312
313
} else {
313
314
console . log ( "ERROR: argument driver has illegal value " + runner , [
314
- BENCHMARK_RUNNER . WEBDRIVER_CDP ,
315
- BENCHMARK_RUNNER . WEBDRIVER ,
316
- BENCHMARK_RUNNER . PLAYWRIGHT ,
317
- BENCHMARK_RUNNER . PUPPETEER ,
315
+ BenchmarkRunner . WEBDRIVER_CDP ,
316
+ BenchmarkRunner . WEBDRIVER ,
317
+ BenchmarkRunner . PLAYWRIGHT ,
318
+ BenchmarkRunner . PUPPETEER ,
318
319
] ) ;
319
320
process . exit ( 1 ) ;
320
321
}
@@ -360,8 +361,8 @@ console.log("benchmarkOptions", benchmarkOptions);
360
361
args . benchmark && args . benchmark . length > 0 ? args . benchmark : [ "" ] ;
361
362
let runBenchmarks : Array < BenchmarkInfo > = benchmarkInfos . filter (
362
363
( b ) =>
363
- // afterframe currently only targets CPU benchmarks
364
- ( config . BENCHMARK_RUNNER !== BENCHMARK_RUNNER . WEBDRIVER_AFTERFRAME ||
364
+ // afterframe currently only targets CPU benchmarks
365
+ ( config . BENCHMARK_RUNNER !== BenchmarkRunner . WEBDRIVER_AFTERFRAME ||
365
366
b . type == BenchmarkType . CPU ) &&
366
367
runBenchmarksArgs . some ( ( name ) => b . id . toLowerCase ( ) . indexOf ( name ) > - 1 )
367
368
) ;
@@ -370,7 +371,7 @@ console.log("benchmarkOptions", benchmarkOptions);
370
371
let matchesDirectoryArg = ( directoryName : string ) =>
371
372
frameworkArgument . length == 0 || frameworkArgument . some ( ( arg : string ) => arg == directoryName ) ;
372
373
runFrameworks = ( await initializeFrameworks ( benchmarkOptions , matchesDirectoryArg ) ) . filter (
373
- ( f ) => f . keyed || config . BENCHMARK_RUNNER !== BENCHMARK_RUNNER . WEBDRIVER_AFTERFRAME
374
+ ( f ) => f . keyed || config . BENCHMARK_RUNNER !== BenchmarkRunner . WEBDRIVER_AFTERFRAME
374
375
) ;
375
376
376
377
console . log ( "ARGS.smotest" , args . smoketest ) ;
@@ -386,7 +387,7 @@ console.log("benchmarkOptions", benchmarkOptions);
386
387
} ) ;
387
388
console . log ( "Using smoketest config " , JSON . stringify ( config ) ) ;
388
389
}
389
- if ( config . BENCHMARK_RUNNER == BENCHMARK_RUNNER . WEBDRIVER_AFTERFRAME ) {
390
+ if ( config . BENCHMARK_RUNNER == BenchmarkRunner . WEBDRIVER_AFTERFRAME ) {
390
391
benchmarkOptions . resultsDirectory = "results_client_" + benchmarkOptions . browser ;
391
392
}
392
393
if ( ! fs . existsSync ( benchmarkOptions . resultsDirectory ) )
0 commit comments