☕️ Classic, reliable, trusted test framework for Node.js and the browser
fix reference error when devicePixelRatio is not defined. Closes #549
TJ Holowaychuk5b4331411198
diff --git a/lib/reporters/html.js b/lib/reporters/html.jsindex f1fb221e..6c435666 100644--- a/lib/reporters/html.js+++ b/lib/reporters/html.js@@ -63,12 +63,13 @@ function HTML(runner) {, ctxif (canvas.getContext) {+ var ratio = window.devicePixelRatio || 1;canvas.style.width = canvas.width;canvas.style.height = canvas.height;- canvas.width *= devicePixelRatio;- canvas.height *= devicePixelRatio;+ canvas.width *= ratio;+ canvas.height *= ratio;ctx = canvas.getContext('2d');- ctx.scale(devicePixelRatio, devicePixelRatio);+ ctx.scale(ratio, ratio);progress = new Progress;}diff --git a/mocha.js b/mocha.jsindex 8eab9028..c248bff9 100644--- a/mocha.js+++ b/mocha.js@@ -1779,12 +1779,13 @@ function HTML(runner) {, ctxif (canvas.getContext) {+ var ratio = window.devicePixelRatio || 1;canvas.style.width = canvas.width;canvas.style.height = canvas.height;- canvas.width *= devicePixelRatio;- canvas.height *= devicePixelRatio;+ canvas.width *= ratio;+ canvas.height *= ratio;ctx = canvas.getContext('2d');- ctx.scale(devicePixelRatio, devicePixelRatio);+ ctx.scale(ratio, ratio);progress = new Progress;}@@ -4661,9 +4662,7 @@ window.mocha = require('mocha');var Reporter = options.reporter || mocha.reporters.HTML;var reporter = new Reporter(runner);var query = parse(window.location.search || "");- console.log(query.grep);- console.log(decodeURIComponent(query.grep));- if (query.grep) runner.grep(new RegExp(decodeURIComponent(query.grep)));+ if (query.grep) runner.grep(new RegExp(query.grep));if (options.grep) runner.grep(options.grep);if (options.ignoreLeaks) runner.ignoreLeaks = true;if (options.globals) runner.globals(options.globals);