INNER CODE UNIT · TypeScript
getHistoricWeights
SveltyCMS/SveltyCMS · scripts/benchmark-matrix/index.ts:258
function getHistoricWeights(): Record<string, number> {
const jsonlPath = "tests/benchmarks/results/history.jsonl";
const weights: Record<string, number> = {};
if (!fs.existsSync(jsonlPath)) return weights;
try {
const raw = fs.readFileSync(jsonlPath, "utf8").trim().split("\n").filter(Boolean);
const entries = raw.map((line) => JSON.parse(line));
const groups: Record<string, number[]> = {};
for (const e of entries) {
if (e.testFile && e.wallClockMs && e.status === "SUCCESS") {
const baseName = path.basename(e.testFile).replace(".test.ts", "");
if (!groups[baseName]) groups[baseName] = [];
groups[baseName].push(e.wallClockMs);
}
}