From 3186f53c4c97fa177e98cb62b09578fe69d0e0c3 Mon Sep 17 00:00:00 2001 From: Sune Simonsen Date: Mon, 6 Jul 2015 21:43:40 +0200 Subject: [PATCH] Fix: html-runner crashing because of missing process.stdout shim When running mocha in the browser you get a crash in the following code: if (isatty) { exports.window.width = process.stdout.getWindowSize ? process.stdout.getWindowSize(1)[0] : tty.getWindowSize()[1]; } That is because we need to shim the process.stdout before requiring mocha from browser-entry.js, I fixed that by moving it to the top of the file. --- support/browser-entry.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/support/browser-entry.js b/support/browser-entry.js index 7655807fae..c711ce3e3a 100644 --- a/support/browser-entry.js +++ b/support/browser-entry.js @@ -1,3 +1,9 @@ +/** + * Shim process.stdout. + */ + +process.stdout = require('browser-stdout')(); + var Mocha = require('../'); /** @@ -140,12 +146,6 @@ mocha.run = function(fn){ }); }; -/** - * Shim process.stdout. - */ - -process.stdout = require('browser-stdout')(); - /** * Expose the process shim. * https://github.com/mochajs/mocha/pull/916