diff --git a/lib/plugins.js b/lib/plugins.js index 36fa39a28..0118b5f75 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -68,7 +68,7 @@ function pluginFunFactory(funName) { } // Output test results - if(pluginResult.specResults) { + if (pluginResult.specResults) { console.log('Plugin: ' + names[i] + ' (' + funName + ')'); for (var j = 0; j < pluginResult.specResults.length; j++) { var specResult = pluginResult.specResults[j]; @@ -102,17 +102,28 @@ function pluginFunFactory(funName) { } /** - * Sets up plugins before tests are run. - * @return {q.Promise} A promise which resolves when the plugins have all been - * set up. + * Sets up plugins before tests are run. + * + * @return {q.Promise} A promise which resolves when the plugins have all been + * set up. */ Plugins.prototype.setup = pluginFunFactory('setup'); /** - * Tears down plugins after tests are run. - * @return {q.Promise} A promise which resolves when the plugins have all been - * torn down. + * Tears down plugins after tests are run. + * + * @return {q.Promise} A promise which resolves when the plugins have all been + * torn down. */ Plugins.prototype.teardown = pluginFunFactory('teardown'); +/** + * Run after the test results have been processed (any values returned will + * be ignored), but before the process exits. Final chance for cleanup. + * + * @return {q.Promise} A promise which resolves when the plugins have all been + * torn down. + */ +Plugins.prototype.postResults = pluginFunFactory('postResults'); + module.exports = Plugins; diff --git a/lib/runner.js b/lib/runner.js index 3a8116c70..428bf96b2 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -316,7 +316,10 @@ Runner.prototype.run = function() { } else { return self.driverprovider_.teardownEnv(); } - // 7) Exit process + // 7) Let plugins do final cleanup + }).then(function() { + return plugins.postResults(); + // 8) Exit process }).then(function() { var exitCode = testPassed ? 0 : 1; return self.exit_(exitCode);