Skip to content

Commit 73b7808

Browse files
committed
Build/Test Tools: Fix performance tests logging script after [58076].
Removes some unintended debug cruft, whoops! See #59900. git-svn-id: https://develop.svn.wordpress.org/trunk@58077 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 53b75a1 commit 73b7808

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

tests/performance/log-results.js

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,26 @@ const testSuiteMap = {
3131
*/
3232
const afterStats = parseFile( 'performance-results.json' );
3333

34+
if ( ! 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[]>[]}>}
3641
*/
3742
const baseStats = parseFile( 'base-performance-results.json' );
3843

44+
if ( ! baseStats.length ) {
45+
console.error( 'No base results file found' );
46+
process.exit( 1 );
47+
}
48+
3949
/**
4050
* @type {Record<string, number>}
4151
*/
4252
const metrics = {};
53+
4354
/**
4455
* @type {Record<string, number>}
4556
*/
@@ -65,38 +76,14 @@ for ( const { title, results } of afterStats ) {
6576
}
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-
9279
const data = new TextEncoder().encode(
9380
JSON.stringify( {
9481
branch,
9582
hash,
9683
baseHash,
9784
timestamp: parseInt( timestamp, 10 ),
98-
metrics: formatResults( testResults ),
99-
baseMetrics: formatResults( baseResults ),
85+
metrics: metrics,
86+
baseMetrics: baseMetrics,
10087
} )
10188
);
10289

0 commit comments

Comments
 (0)