From 904921d8c4a1c2daffd0f737b499cc5a8350c222 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 28 Jan 2013 23:34:27 -0800 Subject: [PATCH] Add a `--time-limit` option to test-build.js so travis-ci can complete its test runs. Former-commit-id: 742b17208d6c9316efea33c106e7689b9290f48d --- package.json | 2 +- test/test-build.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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); + } }());