diff --git a/README.md b/README.md index a03ce58a4..f5ca4e0ce 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ For syntax, see [lookup.json](./lib/lookup.json), the available attributes are: "useGitClone": true Use a shallow git clone instead of downloading the module "ignoreGitHead": Ignore the gitHead field if it exists and fallback to using github tags "yarn": Install and test the project using yarn instead of npm +"timeoutLength": Number of milliseconds before timeout ``` If you want to pass options to npm, eg `--registry`, you can usually define an diff --git a/lib/common-args.js b/lib/common-args.js index 6df75001b..1516f466f 100644 --- a/lib/common-args.js +++ b/lib/common-args.js @@ -73,8 +73,7 @@ module.exports = function commonArgs(app) { .option('timeout', { alias: 'o', type: 'number', - description: 'Set timeout for npm install', - default: 1000 * 60 * 10 + description: 'Set timeout for npm install' }) .option('yarn', { alias: 'y', diff --git a/lib/lookup.js b/lib/lookup.js index e98aa02d3..8514fcd64 100644 --- a/lib/lookup.js +++ b/lib/lookup.js @@ -162,6 +162,9 @@ function resolve(context) { if (rep.yarn) { context.module.useYarn = true; } + if (rep.timeoutLength) { + context.module.timeoutLength = rep.timeoutLength; + } context.module.flaky = context.options.failFlaky ? false : isMatch(rep.flaky); diff --git a/lib/lookup.json b/lib/lookup.json index 5e8517c52..6c912eed3 100644 --- a/lib/lookup.json +++ b/lib/lookup.json @@ -237,6 +237,12 @@ "maintainers": "jeresig", "ignoreGitHead": true }, + "jsdom": { + "maintainers": ["domenic", "Zirro"], + "timeoutLength": 1200000, + "useGitClone": true, + "yarn": true + }, "koa": { "flaky": "ubuntu", "maintainers": "tj" diff --git a/lib/package-manager/test.js b/lib/package-manager/test.js index b40b7f4e3..51839336c 100644 --- a/lib/package-manager/test.js +++ b/lib/package-manager/test.js @@ -106,7 +106,13 @@ async function test(packageManager, context) { ); const proc = spawn(bin, args, options); - const finish = timeout(context, proc, runScript, 'Test'); + const finish = timeout( + context, + proc, + runScript, + 'Test', + context.module.timeoutLength + ); proc.stdout.on('data', (data) => { context.testOutput.append(data); diff --git a/lib/timeout.js b/lib/timeout.js index 767385d96..0f900cc5b 100644 --- a/lib/timeout.js +++ b/lib/timeout.js @@ -3,9 +3,10 @@ // Default timeout to 10 minutes if not provided const kDefaultTimeout = 1000 * 60 * 10; -function timeout(context, proc, next, step) { +function timeout(context, proc, next, step, moduleConfigTimeout) { let hasRun = false; - const delay = context.options.timeoutLength || kDefaultTimeout; + const delay = + context.options.timeoutLength || moduleConfigTimeout || kDefaultTimeout; // Third arg === `true` is the way to signal `finish` that this is a timeout. // Otherwise it acts like a "regular" callback, i.e. `(err, ret) => {}`. // `if (timedOut)` will overwrite `err` & `ret`, so first 2 args are ignored.