From 359ec37aecc1e9fec5e29880691acab29013d6d8 Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Mon, 10 Jul 2017 16:18:45 -0700 Subject: [PATCH] ci: optionals only on branches, no silent for small tests --- .travis.yml | 24 ++++++++++++------------ tests/e2e/utils/process.ts | 17 +++++++++++++---- tests/e2e_runner.ts | 12 +++++++++++- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52bb688ff173..f55be623b226 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,14 +13,6 @@ env: - DBUS_SESSION_BUS_ADDRESS=/dev/null -matrix: - allow_failures: - - env: nightly - - env: ng2 - - node_js: "7" - - node_js: "8" - - matrix: fast_finish: true allow_failures: @@ -40,19 +32,19 @@ matrix: env: test - node_js: "6" os: linux - script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=0 + script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=0 --nosilent env: e2e-0 - node_js: "6" os: linux - script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=1 + script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=1 --nosilent env: e2e-1 - node_js: "6" os: linux - script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=2 + script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=2 --nosilent env: e2e-2 - node_js: "6" os: linux - script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=3 + script: node tests/run_e2e.js "--ignore=**/tests/build/**" --nb-shards=4 --shard=3 --nosilent env: e2e-3 - node_js: "6" os: linux @@ -64,18 +56,26 @@ matrix: os: linux script: node tests/run_e2e.js --ng2 "--glob=tests/{build,test,misc}/**" env: ng2 + on: + all_branches: true - node_js: "6" os: linux script: node tests/run_e2e.js "--nightly --glob=tests/{build,test,misc}/**" env: nightly + on: + all_branches: true - node_js: "7" os: linux script: node tests/run_e2e.js "--glob=tests/{build,test,misc}/**" env: node7 + on: + all_branches: true - node_js: "8" os: linux script: node tests/run_e2e.js "--glob=tests/build/**" env: node8 + on: + all_branches: true - stage: deploy script: skip diff --git a/tests/e2e/utils/process.ts b/tests/e2e/utils/process.ts index 6e33abc6da95..26f662ccf4f0 100644 --- a/tests/e2e/utils/process.ts +++ b/tests/e2e/utils/process.ts @@ -139,11 +139,12 @@ export function silentExecAndWaitForOutputToMatch(cmd: string, args: string[], m let npmInstalledEject = false; export function ng(...args: string[]) { + const argv = getGlobalVariable('argv'); + const maybeSilentNg = argv['nosilent'] ? noSilentNg : silentNg; if (['build', 'serve', 'test', 'e2e', 'xi18n'].indexOf(args[0]) != -1) { // If we have the --eject, use webpack for the test. - const argv = getGlobalVariable('argv'); if (args[0] == 'build' && argv.eject) { - return silentNg('eject', ...args.slice(1), '--force') + return maybeSilentNg('eject', ...args.slice(1), '--force') .then(() => { if (!npmInstalledEject) { npmInstalledEject = true; @@ -153,14 +154,22 @@ export function ng(...args: string[]) { }) .then(() => rimraf('dist')) .then(() => _exec({silent: true}, 'node_modules/.bin/webpack', [])); + } else if (args[0] == 'e2e') { + // Wait 1 second before running any end-to-end test. + return new Promise(resolve => setTimeout(resolve, 1000)) + .then(() => maybeSilentNg(...args)); } - return silentNg(...args); + return maybeSilentNg(...args); } else { - return _exec({}, 'ng', args); + return noSilentNg(...args); } } +export function noSilentNg(...args: string[]) { + return _exec({}, 'ng', args); +} + export function silentNg(...args: string[]) { return _exec({silent: true}, 'ng', args); } diff --git a/tests/e2e_runner.ts b/tests/e2e_runner.ts index ac58f9d84cb9..21e79a502564 100644 --- a/tests/e2e_runner.ts +++ b/tests/e2e_runner.ts @@ -28,6 +28,7 @@ Error.stackTraceLimit = Infinity; * --nobuild Skip building the packages. Use with --nolink and --reuse to quickly * rerun tests. * --nolink Skip linking your local @angular/cli directory. Can save a few seconds. + * --nosilent Never silence ng commands. * --ng-sha=SHA Use a specific ng-sha. Similar to nightly but point to a master SHA instead * of using the latest. * --glob Run tests matching this glob pattern (relative to tests/e2e/). @@ -42,7 +43,16 @@ Error.stackTraceLimit = Infinity; * If unnamed flags are passed in, the list of tests will be filtered to include only those passed. */ const argv = minimist(process.argv.slice(2), { - 'boolean': ['debug', 'nolink', 'nightly', 'noproject', 'verbose', 'eject', 'appveyor'], + 'boolean': [ + 'appveyor', + 'debug', + 'eject', + 'nightly', + 'nolink', + 'nosilent', + 'noproject', + 'verbose', + ], 'string': ['glob', 'ignore', 'reuse', 'ng-sha', ], 'number': ['nb-shards', 'shard'] });