Make WordPress Core

Changeset 58077


Ignore:
Timestamp:
05/02/2024 02:40:30 PM (13 months ago)
Author:
swissspidy
Message:

Build/Test Tools: Fix performance tests logging script after [58076].

Removes some unintended debug cruft, whoops!

See #59900.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/performance/log-results.js

    r58076 r58077  
    3232const afterStats = parseFile( 'performance-results.json' );
    3333
     34if ( ! afterStats.length ) {
     35    console.error( 'No results file found' );
     36    process.exit( 1 );
     37}
     38
    3439/**
    3540 * @type {Array<{file: string, title: string, results: Record<string,number[]>[]}>}
     
    3742const baseStats = parseFile( 'base-performance-results.json' );
    3843
     44if ( ! baseStats.length ) {
     45    console.error( 'No base results file found' );
     46    process.exit( 1 );
     47}
     48
    3949/**
    4050 * @type {Record<string, number>}
    4151 */
    4252const metrics = {};
     53
    4354/**
    4455 * @type {Record<string, number>}
     
    6677}
    6778
    68 process.exit( 0 );
    69 
    70 /**
    71  * Gets the array of metrics from a list of results.
    72  *
    73  * @param {Object[]} results A list of results to format.
    74  * @return {Object} Metrics.
    75  */
    76 const formatResults = ( results ) => {
    77     return results.reduce( ( result, { key, file } ) => {
    78         return {
    79             ...result,
    80             ...Object.fromEntries(
    81                 Object.entries( parseFile( file ) ?? {} ).map(
    82                     ( [ metric, value ] ) => [
    83                         key + '-' + metric,
    84                         median( value ),
    85                     ]
    86                 )
    87             ),
    88         };
    89     }, {} );
    90 };
    91 
    9279const data = new TextEncoder().encode(
    9380    JSON.stringify( {
     
    9683        baseHash,
    9784        timestamp: parseInt( timestamp, 10 ),
    98         metrics: formatResults( testResults ),
    99         baseMetrics: formatResults( baseResults ),
     85        metrics: metrics,
     86        baseMetrics: baseMetrics,
    10087    } )
    10188);
Note: See TracChangeset for help on using the changeset viewer.