jest-html-cumulative-reporter
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ { | ||
"title": "Jest HTML Cumulative Reporter", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"private": false, | ||
@@ -52,4 +52,3 @@ "main": "dist/index.js", | ||
"ansi-to-html": "^0.6.14", | ||
"dateformat": "^3.0.3", | ||
"escape-html": "^1.0.3" | ||
"dateformat": "^3.0.3" | ||
}, | ||
@@ -56,0 +55,0 @@ "scripts": { |
const Convert = require('ansi-to-html'); | ||
const escapeHtml = require('escape-html'); | ||
const convert = new Convert(); | ||
const replaceTag = (tag) => { | ||
const tagsToReplace = { | ||
'&': '&', | ||
'<': '<', | ||
'>': '>', | ||
}; | ||
return tagsToReplace[tag] || tag; | ||
}; | ||
const updateReportResults = ({ options, report, results }) => { | ||
@@ -25,4 +33,5 @@ const { ignore = [] } = options; | ||
// Format error messages. | ||
mergedTest.failureMessages = mergedTest.failureMessages.map((msg) => escapeHtml(convert.toHtml(msg.replace(/[\r]+/g, '')))); | ||
mergedTest.failureMessages = mergedTest.failureMessages.map((msg) => convert.toHtml(msg.replace(/[\r]+/g, '')).replace(/[&<>]/g, replaceTag)); | ||
return mergedTest; | ||
@@ -29,0 +38,0 @@ }; |
36963
0.27%4
-20%682
1.04%- Removed
- Removed