Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Added support for `window.onerror`.

Guillermo Raucha0182f784bd3
diff --git a/mocha.js b/mocha.js
index 961429d9..c6739667 100644
--- a/mocha.js
+++ b/mocha.js
@@ -2318,8 +2318,16 @@ module.exports = function(paths, fn){
process = {};
process.nextTick = function(fn){ setTimeout(fn, 0); };
-process.removeListener = function(fn){};
-process.on = function(){};
+process.removeListener = function(ev){
+ if ('uncaughtException' == ev) {
+ window.onerror = null;
+ }
+};
+process.on = function(ev, fn){
+ if ('uncaughtException' == ev) {
+ window.onerror = fn;
+ }
+};
process.exit = function(status){};
process.stdout = {};
global = this;