2023-12-12 09:33:34 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
|
|
|
const program = require( 'commander' );
|
|
|
|
const { runPerformanceTests } = require( './performance' );
|
|
|
|
|
|
|
|
const catchException = ( command ) => {
|
|
|
|
return async ( ...args ) => {
|
|
|
|
try {
|
|
|
|
await command( ...args );
|
|
|
|
} catch ( error ) {
|
|
|
|
console.error( error );
|
|
|
|
process.exitCode = 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
program
|
|
|
|
.command( 'compare-performance [branches...]' )
|
|
|
|
.alias( 'perf' )
|
2024-09-13 06:58:44 +00:00
|
|
|
.option(
|
|
|
|
'-c, --ci',
|
|
|
|
'Run in CI (non interactive)'
|
|
|
|
)
|
|
|
|
.option(
|
|
|
|
'--skip-benchmarking',
|
|
|
|
'Skips benchmarking and gets straight to reporting phase (tests results already available)'
|
|
|
|
)
|
2023-12-12 09:33:34 +00:00
|
|
|
.option(
|
|
|
|
'--rounds <count>',
|
|
|
|
'Run each test suite this many times for each branch; results are summarized, default = 1'
|
|
|
|
)
|
|
|
|
.option(
|
|
|
|
'--tests-branch <branch>',
|
|
|
|
"Use this branch's performance test files"
|
|
|
|
)
|
|
|
|
.option(
|
|
|
|
'--wp-version <version>',
|
|
|
|
'Specify a WordPress version on which to test all branches'
|
|
|
|
)
|
|
|
|
.description(
|
|
|
|
'Runs performance tests on two separate branches and outputs the result'
|
|
|
|
)
|
|
|
|
.action( catchException( runPerformanceTests ) );
|
|
|
|
|
|
|
|
program.parse( process.argv );
|