UNPKG

perfrunner-core

Version:

Automated UI performance test tool to measure performance changes for the web apps and sites

25 lines (24 loc) 884 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getConnectionString = void 0; const hex = (x) => x.toString(16); function hash(text) { let hash = 0; let chr; for (let i = 0; i < text.length; i++) { chr = text.charCodeAt(i); hash = (hash << 5) - hash + chr; hash |= 0; } return hash; } function generateReportName(url) { const meaningfulUrl = `${url.protocol}//${url.host}${url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'}`; const hashedUrl = hash(meaningfulUrl); const fileName = hex(hashedUrl); return fileName; } const getConnectionString = (outputFolder, url, testName) => { return `${outputFolder}/${testName !== null && testName !== void 0 ? testName : generateReportName(url)}.json`; }; exports.getConnectionString = getConnectionString;