e2ed
Version:
E2E testing framework over Playwright
24 lines (23 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestRunError = void 0;
const sanitizeHtml_1 = require("../sanitizeHtml");
const sanitizeHtml = sanitizeHtml_1.sanitizeHtml;
/**
* Renders `TestRun` error as a simple message.
* This base client function should not use scope variables (except other base functions).
* @internal
*/
const TestRunError = ({ 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 (jsx.createElement("section", { class: "test-error", "aria-label": "Test error" },
jsx.createElement("div", { class: "test-error__content" },
jsx.createElement("pre", null,
jsx.createElement("code", null, runErrorWithoutStyle)))));
};
exports.TestRunError = TestRunError;