feat(test): refactor the memory usage test to use metrics from CLI process instead of test runner (#25708)

This commit is contained in:
cynthialong0-0
2026-04-21 10:06:22 -07:00
committed by GitHub
parent 2c14954010
commit aee2cde1a3
5 changed files with 284 additions and 223 deletions
+12 -12
View File
@@ -10,10 +10,10 @@ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
* Baseline entry for a single memory test scenario.
*/
export interface MemoryBaseline {
heapUsedBytes: number;
heapTotalBytes: number;
rssBytes: number;
externalBytes: number;
heapUsedMB: number;
heapTotalMB: number;
rssMB: number;
externalMB: number;
timestamp: string;
}
@@ -61,18 +61,18 @@ export function updateBaseline(
path: string,
scenarioName: string,
measured: {
heapUsedBytes: number;
heapTotalBytes: number;
rssBytes: number;
externalBytes: number;
heapUsedMB: number;
heapTotalMB: number;
rssMB: number;
externalMB: number;
},
): void {
const baselines = loadBaselines(path);
baselines.scenarios[scenarioName] = {
heapUsedBytes: measured.heapUsedBytes,
heapTotalBytes: measured.heapTotalBytes,
rssBytes: measured.rssBytes,
externalBytes: measured.externalBytes,
heapUsedMB: measured.heapUsedMB,
heapTotalMB: measured.heapTotalMB,
rssMB: measured.rssMB,
externalMB: measured.externalMB,
timestamp: new Date().toISOString(),
};
saveBaselines(path, baselines);