export async function getPathCoverage()

in frontend/src/common.js [64:92]


export async function getPathCoverage(path, changeset, platform, suite) {
  const cacheKey = `${changeset}_${path}_${platform}_${suite}`;
  let data = cacheGet(pathCoverageCache, cacheKey);
  if (data) {
    return data;
  }

  let params = `path=${path}`;
  if (changeset && changeset !== REV_LATEST) {
    params += `&changeset=${changeset}`;
  }
  if (platform && platform !== "all") {
    params += `&platform=${platform}`;
  }
  if (suite && suite !== "all") {
    params += `&suite=${suite}`;
  }
  const response = await fetch(
    `${COVERAGE_BACKEND_HOST}/v2/path?${params}`,
  ).catch(alert);
  if (response.status !== 200) {
    throw new Error(response.status + " - " + response.statusText);
  }
  data = await response.json();

  cacheSet(pathCoverageCache, cacheKey, data);

  return data;
}