Make travis-ci tests go right up to the max run time.

Former-commit-id: 15124a63d530c416ad1974898b7c1e3ee53c58a6
This commit is contained in:
John-David Dalton
2013-02-02 01:14:06 -08:00
parent 60aa50ae45
commit 8a03c5f998
2 changed files with 13 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ node_js:
env:
- TEST_COMMAND="node ./test/test.js"
- TEST_COMMAND="node ./test/test.js ./lodash.min.js"
- TEST_COMMAND="node ./test/test-build.js --time-limit 45"
- TEST_COMMAND="node ./test/test-build.js --time-limit 49m45s"
git:
depth: 1
branches:

View File

@@ -19,10 +19,17 @@
global.QUnit
);
/** The time limit for the tests to run (minutes) */
/** The time limit for the tests to run (milliseconds) */
var timeLimit = process.argv.reduce(function(result, value, index) {
return (/--time-limit/.test(value) && parseFloat(process.argv[index + 1])) || result;
}, Infinity);
if (/--time-limit/.test(value)) {
return parseInt(process.argv[index + 1].replace(/(\d+h)?(\d+m)?(\d+s)?/, function(match, h, m, s) {
return ((parseInt(h) || 0) * 3600000) +
((parseInt(m) || 0) * 60000) +
((parseInt(s) || 0) * 1000);
})) || result;
}
return result;
}, 0);
/** Used to associate aliases with their real names */
var aliasToRealMap = {
@@ -1213,10 +1220,10 @@
/*--------------------------------------------------------------------------*/
if (isFinite(timeLimit)) {
if (timeLimit > 0) {
setTimeout(function() {
process.exit(QUnit.config.stats.bad ? 1 : 0);
}, timeLimit * 6e4);
}, timeLimit);
}
// explicitly call `QUnit.start()` for Narwhal, Node.js, Rhino, and RingoJS
if (!global.document) {