Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Properly Escape Suite and Test Titles for Doc

Paul Armstrong1c9183aa7b1f
diff --git a/lib/reporters/doc.js b/lib/reporters/doc.js
index 071f36aa..2e5bf57f 100644
--- a/lib/reporters/doc.js
+++ b/lib/reporters/doc.js
@@ -36,7 +36,7 @@ function Doc(runner) {
++indents;
console.log('%s<section class="suite">', indent());
++indents;
- console.log('%s<h1>%s</h1>', indent(), suite.title);
+ console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
console.log('%s<dl>', indent());
});
@@ -49,7 +49,7 @@ function Doc(runner) {
});
runner.on('pass', function(test){
- console.log('%s <dt>%s</dt>', indent(), test.title);
+ console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
var code = utils.escape(utils.clean(test.fn.toString()));
console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
});