From 9fe2b0a469613c38e9b79cc24b630f6cacafe634 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Wed, 17 Jun 2015 09:08:26 -0700 Subject: [PATCH] Fix #154 Mocha unit tests should timeout @ 2sec - set default timeout to 2 seconds when the debugger is not attached --- Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js b/Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js index 479250258..8b4b9fb16 100644 --- a/Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js +++ b/Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js @@ -55,8 +55,15 @@ var run_tests = function (testName, testFile, workingFolder, projectFolder) { var mocha = new Mocha(); mocha.ui('tdd'); - //set timeout to 10 minutes, because the default of 2 sec might be too short (TODO: make it configurable) - mocha.suite.timeout(600000); + + //set timeout to 10 minutes, because the default of 2 sec is too short for debugging scenarios + // TODO: make it configurable + if (typeof (v8debug) === 'object') { + mocha.suite.timeout(600000); + } else { + mocha.suite.timeout(2000) + } + if (testName) { mocha.grep(testName); }