From 0c4ef69c1f61a2fb41829fa6d0afae3493148eee Mon Sep 17 00:00:00 2001 From: Julie Date: Thu, 13 Mar 2014 16:49:45 -0700 Subject: [PATCH] feat(launcher): launcher outputs a final summary of how the browsers did --- lib/launcher.js | 19 +++++++++++++++++-- lib/runFromLauncher.js | 4 ++-- lib/runner.js | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/launcher.js b/lib/launcher.js index 752950955..524847016 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -21,7 +21,6 @@ var noLineLog_ = function(stuff) { process.stdout.write(launcherPrefix + stuff); } - var reportHeader_ = function(childFork) { var capability = childFork.capability; var eol = require('os').EOL; @@ -70,7 +69,19 @@ var init = function(argv) { if (remaining) { noLineLog_(remaining + ' instance(s) of WebDriver still running'); } - } + }; + + var logSummary = function() { + childForks.forEach(function(childFork) { + var shortChildName = childFork.capability.browserName + + (childFork.runNumber ? ' #' + childFork.runNumber : ''); + if (childFork.failedCount) { + log_(shortChildName + ' failed ' + childFork.failedCount + ' test(s)'); + } else { + log_(shortChildName + ' passed'); + } + }); + }; if (config.multiCapabilities.length) { if (config.debug) { @@ -160,6 +171,9 @@ var init = function(argv) { case 'testFail': process.stdout.write('F'); break; + case 'testsDone': + childFork.failedCount = m.failedCount; + break; } }); @@ -189,6 +203,7 @@ var init = function(argv) { } process.on('exit', function(code) { + logSummary(); process.exit(launcherExitCode); }); }; diff --git a/lib/runFromLauncher.js b/lib/runFromLauncher.js index c05ffe2d8..8dcf7bb37 100644 --- a/lib/runFromLauncher.js +++ b/lib/runFromLauncher.js @@ -41,10 +41,10 @@ process.on('message', function(m) { event: 'testFail' }); }); - runner.on('testsDone', function(results) { + runner.on('testsDone', function(failedCount) { process.send({ event: 'testsDone', - results: results + failedCount: failedCount }); }); diff --git a/lib/runner.js b/lib/runner.js index d458171d8..d7800bd9a 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -413,7 +413,7 @@ Runner.prototype.run = function() { // 3) Teardown }).then(function(result) { - self.emit('testsDone', result); + self.emit('testsDone', result.failedCount); testResult = result; if (self.driverprovider_.updateJob) { return self.driverprovider_.updateJob({