From 19c89cdc47a8ed6aec0fc8e3fdc60dcc87f92d93 Mon Sep 17 00:00:00 2001
From: Benedikt Huss <ben305@users.noreply.github.com>
Date: Tue, 16 Aug 2016 17:17:30 +0200
Subject: [PATCH] Allow specifying global mocha timeout

---
 client.js | 1 +
 server.js | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/client.js b/client.js
index 69c6b7b..8d205c5 100644
--- a/client.js
+++ b/client.js
@@ -4,6 +4,7 @@ import 'mocha/mocha.js';
 // This defines "describe", "it", etc.
 mocha.setup({
   ui: 'bdd',
+  timeout: Meteor.settings.public["MOCHA_TIMEOUT"] || 2000,
 });
 
 export { mocha };
diff --git a/server.js b/server.js
index 53f82bd..9248772 100755
--- a/server.js
+++ b/server.js
@@ -108,8 +108,12 @@ function setupGlobals(mocha) {
 // can use to ensure they work well with other test driver packages.
 const mochaInstance = new Mocha({
   ui: 'bdd',
-  ignoreLeaks: true
+  ignoreLeaks: true,
+  timeout: process.env.MOCHA_TIMEOUT || 2000
 });
 setupGlobals(mochaInstance);
- 
+
+// Pass timeout to client
+Meteor.settings.public["MOCHA_TIMEOUT"] = process.env.MOCHA_TIMEOUT || 2000;
+
 export { mochaInstance, setupGlobals, Mocha };