Skip to content

armgit / mocha

Public Imported from GitHub
0

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

use $ so HTML reporter doesnt break the SS

Tj Holowaychuk36640df0b4eb
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index c84d8eb0..1560dbeb 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -21,12 +21,6 @@ var statsTemplate = '<ul id="stats">'
+ '<li class="duration">duration: <em>0</em>s</li>'
+ '</ul>';
-/**
- * $ is annoying.
- */
-
-var o = $;
-
/**
* Initialize a new `Doc` reporter.
*
@@ -42,9 +36,9 @@ function HTML(runner) {
var self = this
, stats = this.stats
, total = runner.total
- , root = o('#mocha')
+ , root = $('#mocha')
, stack = [root]
- , stat = o(statsTemplate).appendTo(root);
+ , stat = $(statsTemplate).appendTo(root);
if (!root.length) error('#mocha div missing, add it to your document');
@@ -52,7 +46,7 @@ function HTML(runner) {
if (suite.root) return;
// suite
- var el = o('<div class="suite"><h1>' + suite.title + '</h1></div>');
+ var el = $('<div class="suite"><h1>' + suite.title + '</h1></div>');
// container
stack[0].append(el);
@@ -74,10 +68,10 @@ function HTML(runner) {
// test
var str = test.passed ? 'pass' : 'fail';
- var el = o('<div class="test ' + str + '"><h2>' + test.title + '</h2></div>')
+ var el = $('<div class="test ' + str + '"><h2>' + test.title + '</h2></div>')
// code
- var pre = o('<pre><code>' + clean(test.fn.toString()) + '</code></pre>');
+ var pre = $('<pre><code>' + clean(test.fn.toString()) + '</code></pre>');
pre.appendTo(el);
stack[0].append(el);
});