Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/reporters/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ exports.run = function (modules, options) {
return el;
};

function HTMLEscape(str) {
return str.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
};

var header = getOrCreate('h1', 'nodeunit-header');
var banner = getOrCreate('h2', 'nodeunit-banner');
var userAgent = getOrCreate('h2', 'nodeunit-userAgent');
Expand Down Expand Up @@ -92,7 +98,7 @@ exports.run = function (modules, options) {
var a = assertions[i];
if (a.failed()) {
li.innerHTML = (a.message || a.method || 'no message') +
'<pre>' + (a.error.stack || a.error) + '</pre>';
'<pre>' + HTMLEscape(a.error.stack || a.error) + '</pre>';
li.className = 'fail';
}
else {
Expand Down