From 4d00925082f500869e5e49fb343e8e142aa22004 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 10 May 2019 17:20:26 +0200 Subject: [PATCH 1/4] pass through timeout value (cherry picked from commit e8428e8f76dfb244c7e9e707749278a6742710f9) --- lib/package-manager/test.js | 8 +++++++- lib/timeout.js | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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. From bfcc325a44a9ac75308d7010469b38fef5fc2fc2 Mon Sep 17 00:00:00 2001 From: Zirro Date: Wed, 29 May 2019 21:01:05 +0200 Subject: [PATCH 2/4] Fix the timeoutLength config option --- lib/common-args.js | 3 +-- lib/lookup.js | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) 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); From 71e516cb4a63a3fe35ebd8e56085da089a72f8c1 Mon Sep 17 00:00:00 2001 From: Zirro Date: Wed, 29 May 2019 21:04:59 +0200 Subject: [PATCH 3/4] lookup: add jsdom --- lib/lookup.json | 6 ++++++ 1 file changed, 6 insertions(+) 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" From af35737067c50134b0f7917ec8fe7c76a650c660 Mon Sep 17 00:00:00 2001 From: Zirro Date: Thu, 30 May 2019 13:58:14 +0200 Subject: [PATCH 4/4] Add timeoutLength to documentation --- README.md | 1 + 1 file changed, 1 insertion(+) 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