Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Expose only the specified UI in the browser

Mike Pennisi2c8aa0ae8978
diff --git a/support/tail.js b/support/tail.js
index 4dcdebe0..e3f1369f 100644
--- a/support/tail.js
+++ b/support/tail.js
@@ -53,6 +53,11 @@ process.on = function(e, fn){
var Mocha = global.Mocha = require('mocha'),
mocha = global.mocha = new Mocha({ reporter: 'html' });
+// The BDD UI is registered by default, but no UI will be functional in the
+// browser without an explicit call to the overridden `mocha.ui` (see below).
+// Ensure that this default UI does not expose its methods to the global scope.
+mocha.suite.removeAllListeners('pre-require');
+
var immediateQueue = []
, immediateTimeout;