const SNAPSHOT_METRIC_KEYS = Object.freeze([
    'typecheckErrors',
    'lintErrors',
    'lintWarnings',
    'testsPassed',
    'testsFailed',
    'testSuites',
    'failedSuites',
]);
export function diffSnapshots(fromSnapshot, toSnapshot) {
    const deltas = {};
    for (const key of SNAPSHOT_METRIC_KEYS) {
        deltas[key] = (toSnapshot.metrics[key] ?? 0) - (fromSnapshot.metrics[key] ?? 0);
    }
    return {
        fromLabel: fromSnapshot.label,
        toLabel: toSnapshot.label,
        branch: toSnapshot.branch,
        deltas,
    };
}
