☕️ Classic, reliable, trusted test framework for Node.js and the browser
smaller progress indicator
TJ Holowaychukb675286790aa
diff --git a/lib/browser/progress.js b/lib/browser/progress.jsindex 76f286db..1d60cde6 100644--- a/lib/browser/progress.js+++ b/lib/browser/progress.js@@ -12,7 +12,7 @@ module.exports = Progress;function Progress() {this.percent = 0;this.size(0);- this.fontSize(12);+ this.fontSize(11);this.font('helvetica, arial, sans-serif');}diff --git a/lib/reporters/html.js b/lib/reporters/html.jsindex a1b1ce3b..169bbbd7 100644--- a/lib/reporters/html.js+++ b/lib/reporters/html.js@@ -19,7 +19,7 @@ exports = module.exports = HTML;*/var statsTemplate = '<ul id="stats">'- + '<li class="progress"><canvas width="50" height="50"></canvas></li>'+ + '<li class="progress"><canvas width="40" height="40"></canvas></li>'+ '<li class="passes">passes: <em>0</em></li>'+ '<li class="failures">failures: <em>0</em></li>'+ '<li class="duration">duration: <em>0</em>s</li>'@@ -54,7 +54,7 @@ function HTML(runner) {if (!root.length) return error('#mocha div missing, add it to your document');- if (progress) progress.size(50);+ if (progress) progress.size(40);runner.on('suite', function(suite){if (suite.root) return;diff --git a/mocha.css b/mocha.cssindex afe870e5..03b582c3 100644--- a/mocha.css+++ b/mocha.css@@ -103,15 +103,15 @@ body {#stats {position: fixed;- top: 30px;- right: 30px;+ top: 10px;+ right: 0;font-size: 12px;margin: 0;color: #888;}#stats .progress {- margin-bottom: 10px;+ float: right;}#stats em {@@ -119,6 +119,8 @@ body {}#stats li {+ display: inline-block;+ margin: 0 5px;list-style: none;}diff --git a/mocha.js b/mocha.jsindex 86527c41..61847b45 100644--- a/mocha.js+++ b/mocha.js@@ -261,7 +261,7 @@ module.exports = Progress;function Progress() {this.percent = 0;this.size(0);- this.fontSize(12);+ this.fontSize(11);this.font('helvetica, arial, sans-serif');}@@ -1208,7 +1208,7 @@ exports = module.exports = HTML;*/var statsTemplate = '<ul id="stats">'- + '<li class="progress"><canvas width="50" height="50"></canvas></li>'+ + '<li class="progress"><canvas width="40" height="40"></canvas></li>'+ '<li class="passes">passes: <em>0</em></li>'+ '<li class="failures">failures: <em>0</em></li>'+ '<li class="duration">duration: <em>0</em>s</li>'@@ -1243,7 +1243,7 @@ function HTML(runner) {if (!root.length) return error('#mocha div missing, add it to your document');- if (progress) progress.size(50);+ if (progress) progress.size(40);runner.on('suite', function(suite){if (suite.root) return;@@ -3145,7 +3145,7 @@ exports.files = function(dir, ret){path = join(dir, path);if (fs.statSync(path).isDirectory()) {exports.files(path, ret);- } else if (path.match(/\.js$/)) {+ } else if (path.match(/\.(js|coffee)$/)) {ret.push(path);}});@@ -3168,6 +3168,10 @@ process.exit = function(status){};process.stdout = {};global = window;+/**+ * next tick implementation.+ */+process.nextTick = (function(){// postMessage behaves badly on IE8if (window.ActiveXObject || !window.postMessage) {@@ -3191,18 +3195,30 @@ process.nextTick = (function(){}})();+/**+ * Remove uncaughtException listener.+ */+process.removeListener = function(e){if ('uncaughtException' == e) {window.onerror = null;}};+/**+ * Implements uncaughtException listener.+ */+process.on = function(e, fn){if ('uncaughtException' == e) {window.onerror = fn;}};+/**+ * Expose mocha.+ */+window.mocha = require('mocha');// boot@@ -3211,6 +3227,10 @@ window.mocha = require('mocha');, utils = mocha.utils, Reporter = mocha.reporters.HTML+ /**+ * Highlight the given string of `js`.+ */+function highlight(js) {return js.replace(/</g, '<')@@ -3223,6 +3243,10 @@ window.mocha = require('mocha');.replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')}+ /**+ * Parse the given `qs`.+ */+function parse(qs) {return utils.reduce(qs.replace('?', '').split('&'), function(obj, pair){var i = pair.indexOf('=')@@ -3234,6 +3258,10 @@ window.mocha = require('mocha');}, {});}+ /**+ * Setup mocha with the give `ui` name.+ */+mocha.setup = function(ui){ui = mocha.interfaces[ui];if (!ui) throw new Error('invalid mocha interface "' + ui + '"');@@ -3241,6 +3269,10 @@ window.mocha = require('mocha');suite.emit('pre-require', window);};+ /**+ * Run mocha, returning the Runner.+ */+mocha.run = function(){suite.emit('run');var runner = new mocha.Runner(suite);@@ -3249,7 +3281,6 @@ window.mocha = require('mocha');if (query.grep) runner.grep(new RegExp(query.grep));runner.on('end', function(){$('code').each(function(){- console.log('code');$(this).html(highlight($(this).text()));});});diff --git a/test/browser/style.css b/test/browser/style.cssindex afe870e5..bd811eb6 100644--- a/test/browser/style.css+++ b/test/browser/style.css@@ -103,15 +103,16 @@ body {#stats {position: fixed;- top: 30px;- right: 30px;+ top: 15px;+ right: 10px;font-size: 12px;margin: 0;color: #888;}#stats .progress {- margin-bottom: 10px;+ float: right;+ padding-top: 0;}#stats em {@@ -119,7 +120,10 @@ body {}#stats li {+ display: inline-block;+ margin: 0 5px;list-style: none;+ padding-top: 11px;}code .comment { color: #ddd }