From 0fb41e5ceda9a260367aa845befcc4ec9357f744 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Fri, 3 Aug 2018 22:38:03 +0300 Subject: [PATCH] test(docs-infra): log docs examples e2e spec paths to aid debugging (#25293) It seems that occasionally the sharding of docs examples e2e tests gets messed up resulting in some tests not being run. This can cause CI to be green on a PR, when they shouldn't (because the failing tests didn't run at all). It is unclear under what circumstances this happens, so printing the paths of found e2e specs will help debug the issue when it comes up again. PR Close #25293 --- aio/tools/examples/run-example-e2e.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/aio/tools/examples/run-example-e2e.js b/aio/tools/examples/run-example-e2e.js index dba71961c4..43c56b134a 100644 --- a/aio/tools/examples/run-example-e2e.js +++ b/aio/tools/examples/run-example-e2e.js @@ -68,7 +68,7 @@ function runE2e() { // that they should run under. Then run each app/spec collection sequentially. function findAndRunE2eTests(filter, outputFile, shard) { - const shardParts = shard ? shard.split('/') : [0,1]; + const shardParts = shard ? shard.split('/') : [0, 1]; const shardModulo = parseInt(shardParts[0], 10); const shardDivider = parseInt(shardParts[1], 10); @@ -82,11 +82,17 @@ function findAndRunE2eTests(filter, outputFile, shard) { const status = { passed: [], failed: [] }; return getE2eSpecs(EXAMPLES_PATH, filter) .then(e2eSpecPaths => { + console.log('All e2e specs:'); + logSpecs(e2eSpecPaths); + Object.keys(e2eSpecPaths).forEach(key => { const value = e2eSpecPaths[key]; e2eSpecPaths[key] = value.filter((p, index) => index % shardDivider === shardModulo); }); + console.log(`E2e specs for shard ${shardParts.join('/')}:`); + logSpecs(e2eSpecPaths); + return e2eSpecPaths.systemjs.reduce((promise, specPath) => { return promise.then(() => { const examplePath = path.dirname(specPath); @@ -313,4 +319,16 @@ function loadExampleConfig(exampleFolder) { return config; } +// Log the specs (for debugging purposes). +// `e2eSpecPaths` is of type: `{[type: string]: string[]}` +// (where `type` is `systemjs`, `cli, etc.) +function logSpecs(e2eSpecPaths) { + Object.keys(e2eSpecPaths).forEach(type => { + const paths = e2eSpecPaths[type]; + + console.log(` ${type.toUpperCase()}:`); + console.log(paths.map(p => ` ${p}`).join('\n')); + }); +} + runE2e();