@dapplion/benchmark
Version:
Ensures that new code does not introduce performance regressions with CI. Tracks:
23 lines (22 loc) • 896 B
JavaScript
import { isGaRun } from "../github/context.js";
import { optionsDefault } from "../options.js";
export function resolveHistoryLocation(opts) {
if (opts.historyLocal && opts.historyGaCache) {
throw Error("Must not set 'historyLocal' and 'historyGaCache'");
}
if (opts.historyLocal) {
const filepath = typeof opts.historyLocal === "string" ? opts.historyLocal : optionsDefault.historyLocalPath;
return { type: "local", path: filepath };
}
if (opts.historyGaCache) {
const cacheKey = typeof opts.historyGaCache === "string" ? opts.historyGaCache : optionsDefault.historyCacheKey;
return { type: "ga-cache", key: cacheKey };
}
// Defaults
if (isGaRun()) {
return { type: "ga-cache", key: optionsDefault.historyCacheKey };
}
else {
return { type: "local", path: optionsDefault.historyLocalPath };
}
}