diff --git a/package.json b/package.json index ff889ba40..32a9a66c8 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,6 @@ }, "scripts": { "build": "node ./build.js", - "test": "node ./test/test.js && node ./test/test.js ./lodash.min.js && node ./test/test-build.js" + "test": "node ./test/test.js && node ./test/test.js ./lodash.min.js && node ./test/test-build.js --time-limit 45" } } diff --git a/test/test-build.js b/test/test-build.js index 9ef86c7dc..0afd34b48 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -14,6 +14,11 @@ var QUnit = global.QUnit = require('../vendor/qunit/qunit/qunit.js'); require('../vendor/qunit-clib/qunit-clib.js'); + /** The time limit for the tests to run (minutes) */ + var timeLimit = process.argv.reduce(function(result, value, index) { + return (/--time-limit/.test(value) && parseFloat(process.argv[index + 1])) || result; + }, Infinity); + /** Used to associate aliases with their real names */ var aliasToRealMap = { 'all': 'every', @@ -1178,4 +1183,9 @@ }); }()); + /*--------------------------------------------------------------------------*/ + + if (isFinite(timeLimit)) { + setTimeout(process.exit, timeLimit * 6e4); + } }());