From 561db4631bfdcf99d3a09499f29167e19b3f2a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Wed, 19 Jul 2017 13:48:00 +0200 Subject: [PATCH] Using a less agressive escape function to fix the tests --- src/junit_reporter.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/junit_reporter.js b/src/junit_reporter.js index 5bcc410..b7069a4 100644 --- a/src/junit_reporter.js +++ b/src/junit_reporter.js @@ -31,13 +31,17 @@ pad(d.getMinutes()) + ':' + pad(d.getSeconds()); } + function escapeControlChars(str) { + // Remove control character from Jasmine default output + return str.replace(/[\x1b]/g, ""); + } function escapeInvalidXmlChars(str) { - return str.replace(/\&/g, "&") + const escaped = str.replace(/\&/g, "&") .replace(//g, ">") .replace(/\"/g, """) - .replace(/\'/g, "'") - .replace(/[\x1b]/g, ""); //Remove control character from Jasmine default output + .replace(/\'/g, "'"); + return escapeControlChars(escaped); } function getQualifiedFilename(path, filename, separator) { if (path && path.substr(-1) !== separator && filename.substr(0) !== separator) { @@ -443,7 +447,7 @@ testCaseBody += '\n '; + testCaseBody += ''; testCaseBody += '\n '; } }