UNPKG

e2ed

Version:

E2E testing framework over Playwright

26 lines (25 loc) 922 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderTestRunError = renderTestRunError; const sanitizeHtml_1 = require("../sanitizeHtml"); const sanitizeHtml = sanitizeHtml_1.sanitizeHtml; /** * Renders `TestRun` error as simple message. * This base client function should not use scope variables (except other base functions). * @internal */ function renderTestRunError(runError) { if (runError === undefined) { return sanitizeHtml ``; } // eslint-disable-next-line no-control-regex const stylesRegexp = /((\\x1B\[)|(\x1B\[)|(\\u001b\[)|(\u001b\[))[\d;]*m/gi; const runErrorWithoutStyle = String(runError).replace(stylesRegexp, ''); return sanitizeHtml ` <div class="status-detail status-detail_status_failed"> <div class="status-detail__content"> <code class="status-detail__button-text">${runErrorWithoutStyle}</code> </div> </div> `; }