From bea32aa458be959a76cc0269df56162db550177a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 11 Jun 2018 16:42:35 +0200 Subject: [PATCH] test(cli): tweak test timeouts --- .../cli/test/acceptance/app-run.acceptance.js | 20 ++++++++++++------- .../test/integration/lib/project-generator.js | 4 ++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/cli/test/acceptance/app-run.acceptance.js b/packages/cli/test/acceptance/app-run.acceptance.js index 4a59d3df566a..40822af661f4 100644 --- a/packages/cli/test/acceptance/app-run.acceptance.js +++ b/packages/cli/test/acceptance/app-run.acceptance.js @@ -23,7 +23,9 @@ describe('app-generator (SLOW)', function() { outdir: sandbox, }; - before(async () => { + before('scaffold a new application', async function createAppProject() { + // Increase the timeout to 1 minute to accomodate slow CI build machines + this.timeout(60 * 1000); await helpers .run(generator) .inDir(sandbox) @@ -32,21 +34,25 @@ describe('app-generator (SLOW)', function() { .withPrompts(props); }); - // Run `lerna bootstrap --scope @loopback/sandbox-app` - // WARNING: It takes a while to run `lerna bootstrap` - this.timeout(0); - before(async () => { + before('install dependencies', async function installDependencies() { + // Run `lerna bootstrap --scope @loopback/sandbox-app` + // WARNING: It takes a while to run `lerna bootstrap` + this.timeout(15 * 60 * 1000); process.chdir(rootDir); await lernaBootstrap(appName); }); - it('passes `npm test` for the generated project', () => { - process.chdir(sandbox); + it('passes `npm test` for the generated project', function() { + // Increase the timeout to 5 minutes, + // the tests can take more than 2 seconds to run. + this.timeout(5 * 60 * 1000); + return new Promise((resolve, reject) => { build .runShell('npm', ['test'], { // Disable stdout stdio: [process.stdin, 'ignore', process.stderr], + cwd: sandbox, }) .on('close', code => { assert.equal(code, 0); diff --git a/packages/cli/test/integration/lib/project-generator.js b/packages/cli/test/integration/lib/project-generator.js index 99bccf835111..08688da30d7e 100644 --- a/packages/cli/test/integration/lib/project-generator.js +++ b/packages/cli/test/integration/lib/project-generator.js @@ -15,6 +15,10 @@ const expect = require('@loopback/testlab').expect; module.exports = function(projGenerator, props, projectType) { return function() { + // Increase the timeout to 60 seconds to accomodate + // for possibly slow CI build machines + this.timeout(60 * 1000); + describe('help', () => { it('prints lb4', () => { const env = yeoman.createEnv();