e2ed
Version:
E2E testing framework over Playwright
21 lines (20 loc) • 835 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.unificateRunHashes = void 0;
const asserts_1 = require("../asserts");
/**
* Unificate all TestRun hashes at once.
* @internal
*/
const unificateRunHashes = (fullTestRuns) => {
const { length } = String(fullTestRuns.length - 1);
for (let index = 0; index < fullTestRuns.length; index += 1) {
const fullTestRun = fullTestRuns[index];
(0, asserts_1.assertValueIsDefined)(fullTestRun, 'fullTestRun is defined', { index, length });
const { runHash } = fullTestRun;
const clearRunHash = runHash.replace(/[# ?:/]+/g, '-');
const uniqueRunHash = `${clearRunHash}-${String(index).padStart(length, '0')}`;
fullTestRun.runHash = uniqueRunHash;
}
};
exports.unificateRunHashes = unificateRunHashes;