Add tests for results with React component names

This commit is contained in:
Jozef Izso 2023-12-18 13:10:06 +01:00
parent c1926959e2
commit 7aa575a237
5 changed files with 70 additions and 1 deletions

5
dist/index.js generated vendored
View file

@ -1212,7 +1212,7 @@ class JestJunitParser {
const suites = junit.testsuites.testsuite === undefined
? []
: junit.testsuites.testsuite.map(ts => {
const name = ts.$.name.trim();
const name = this.escapeCharacters(ts.$.name.trim());
const time = parseFloat(ts.$.time) * 1000;
const sr = new test_results_1.TestSuiteResult(name, this.getGroups(ts), time);
return sr;
@ -1281,6 +1281,9 @@ class JestJunitParser {
var _a, _b;
return ((_b = (_a = this.options.workDir) !== null && _a !== void 0 ? _a : this.assumedWorkDir) !== null && _b !== void 0 ? _b : (this.assumedWorkDir = (0, path_utils_1.getBasePath)(path, this.options.trackedFiles)));
}
escapeCharacters(s) {
return s.replace(/([<>])/g, '\\$1');
}
}
exports.JestJunitParser = JestJunitParser;