INNER CODE UNIT · TypeScript

calculateGlobalRemainingSeconds

SveltyCMS/SveltyCMS · scripts/benchmark-matrix/index.ts:504

function calculateGlobalRemainingSeconds(
  runningTests: Set<string>,
  historicWeights: Record<string, number>,
  concurrency: number,
): number {
  let combinedWeightSeconds = 0;
  for (const file of globalRemainingFiles) {
    const name = getTestName(file);
    combinedWeightSeconds += historicWeights[name] || TEST_WEIGHTS[name] || 10;
  }
  for (const file of runningTests) {
    const name = getTestName(file);
    const totalEst = historicWeights[name] || TEST_WEIGHTS[name] || 10;
    const elapsed = (activeTestDurations.get(file) || 0) / 1000;
    combinedWeightSeconds += Math.max(totalEst * 0.2, totalEst - elapsed);
  }
  return Math.max(0, combinedWeightSeconds / concurrency);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…