@conduitvc/jest-allure-reporter
Version:
A Jest Allure Reporter, which takes the test-results from jest and creates an allure-report from it.
40 lines • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const strip_ansi = require("strip-ansi");
function escapeXml(str, ignore) {
const map = {
">": ">",
"<": "<",
"'": "'",
'"': """,
"&": "&"
};
let pattern;
if (str === null || str === undefined)
return;
ignore = (ignore || "").replace(/[^&"<>\']/g, "");
pattern = '([&"<>\'])'.replace(new RegExp("[" + ignore + "]", "g"), "");
let strSplit = str;
str = "";
strSplit.split("\n").forEach(line => {
if (line.startsWith("Error", 0)) {
line = strip_ansi(line);
line = line.replace(/\u001b/g, "");
line = line.replace(/\u005b/g, "");
line = line.replace(/\u0032/g, "");
line = line.replace(/\u006d/g, "");
line = line.replace(/\u0031/g, "");
line = line.replace(/\u0039/g, "");
line = line.replace(/\u0033/g, "");
}
else {
line = strip_ansi(line);
}
str += line + "\n";
});
return str.replace(new RegExp(pattern, "g"), function (str, item) {
return map[item];
});
}
exports.escapeXml = escapeXml;
//# sourceMappingURL=xmlescape.js.map