Skip to content

Commit

Permalink
Fixup types
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed May 10, 2024
1 parent e4aa308 commit 2a45733
Showing 1 changed file with 31 additions and 44 deletions.
75 changes: 31 additions & 44 deletions test/performance/config/performance-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,50 +38,38 @@ export interface WPRawPerformanceResults {
navigate: number[];
}

type PerformanceStats = {
q25: number;
q50: number;
q75: number;
out: number[]; // outliers
cnt: number; // number of data points
};

export interface WPPerformanceResults {
timeToFirstByte?: number;
timeToFirstByteV?: number;
largestContentfulPaint?: number;
largestContentfulPaintV?: number;
lcpMinusTtfb?: number;
lcpMinusTtfbV?: number;
serverResponse?: number;
serverResponseV?: number;
firstPaint?: number;
firstPaintV?: number;
domContentLoaded?: number;
domContentLoadedV?: number;
loaded?: number;
loadedV?: number;
firstContentfulPaint?: number;
firstContentfulPaintV?: number;
firstBlock?: number;
firstBlockV?: number;
type?: number;
typeV?: number;
typeWithoutInspector?: number;
typeWithoutInspectorV?: number;
typeWithTopToolbar?: number;
typeWithTopToolbarV?: number;
typeContainer?: number;
typeContainerV?: number;
focus?: number;
focusV?: number;
inserterOpen?: number;
inserterOpenV?: number;
inserterSearch?: number;
inserterSearchV?: number;
inserterHover?: number;
inserterHoverV?: number;
loadPatterns?: number;
loadPatternsV?: number;
listViewOpen?: number;
listViewOpenV?: number;
navigate?: number;
navigateV?: number;
timeToFirstByte?: PerformanceStats;
largestContentfulPaint?: PerformanceStats;
lcpMinusTtfb?: PerformanceStats;
serverResponse?: PerformanceStats;
firstPaint?: PerformanceStats;
domContentLoaded?: PerformanceStats;
loaded?: PerformanceStats;
firstContentfulPaint?: PerformanceStats;
firstBlock?: PerformanceStats;
type?: PerformanceStats;
typeWithoutInspector?: PerformanceStats;
typeWithTopToolbar?: PerformanceStats;
typeContainer?: PerformanceStats;
focus?: PerformanceStats;
inserterOpen?: PerformanceStats;
inserterSearch?: PerformanceStats;
inserterHover?: PerformanceStats;
loadPatterns?: PerformanceStats;
listViewOpen?: PerformanceStats;
navigate?: PerformanceStats;
}

function stats( values: number[] ) {
function stats( values: number[] ): PerformanceStats | undefined {
if ( ! values || values.length === 0 ) {
return undefined;
}
Expand All @@ -103,9 +91,8 @@ function stats( values: number[] ) {
/**
* Curate the raw performance results.
*
* @param {WPRawPerformanceResults} results
*
* @return {WPPerformanceResults} Curated Performance results.
* @param results Raw results.
* @return Curated statistics for the results.
*/
export function curateResults(
results: WPRawPerformanceResults
Expand Down

0 comments on commit 2a45733

Please sign in to comment.