☕️ Classic, reliable, trusted test framework for Node.js and the browser
Make Mocha runnable in an iframe
Jo Liss40b4f7bc8124
diff --git a/lib/reporters/html.js b/lib/reporters/html.jsindex 6c435666..629b6d0a 100644--- a/lib/reporters/html.js+++ b/lib/reporters/html.js@@ -42,13 +42,12 @@ var statsTemplate = '<ul id="stats">'* @api public*/-function HTML(runner) {+function HTML(runner, root) {Base.call(this, runner);var self = this, stats = this.stats, total = runner.total- , root = document.getElementById('mocha'), stat = fragment(statsTemplate), items = stat.getElementsByTagName('li'), passes = items[1].getElementsByTagName('em')[0]@@ -62,6 +61,8 @@ function HTML(runner) {, progress, ctx+ root = root || document.getElementById('mocha');+if (canvas.getContext) {var ratio = window.devicePixelRatio || 1;canvas.style.width = canvas.width;@@ -97,7 +98,7 @@ function HTML(runner) {// suitevar grep = '^' + encodeURIComponent(utils.escapeRegexp(suite.fullTitle()));- var url = location.protocol + '//' + location.host + location.pathname + '?grep=' + grep;+ var url = '?grep=' + grep;var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));// container