From 248a37e263c0ce9228951fc97bac28bb90667208 Mon Sep 17 00:00:00 2001 From: PVermeer Date: Tue, 24 Mar 2020 14:57:02 +0100 Subject: [PATCH] Added suppressAll option to config (#40) * feat(config): disable specFailure logging * docs(readme): added config to readme * docs: separate config with options * feat(config): added suppress all messages option Co-authored-by: Pim Vermeer --- README.md | 8 ++++---- src/index.js | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8bddb42..07aa50f 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ module.exports = function(config) { }; ``` #### With options -In combination with multiple reporters you may want to disable failed messages because it's already handled by another reporter. +In combination with multiple reporters you may want to disable terminal messages because it's already handled by another reporter. -*Example when using the 'karma-mocha-reporter' plugin*: +*Example using the 'karma-mocha-reporter' plugin*: ```js // karma.conf.js module.exports = function(config) { @@ -41,8 +41,8 @@ module.exports = function(config) { reporters: ['kjhtml', 'mocha'], jasmineHtmlReporter: { - // Suppress failed messages - suppressFailed: true + suppressAll: true, // Suppress all messages (overrides other suppress settings) + suppressFailed: true // Suppress failed messages } }); diff --git a/src/index.js b/src/index.js index c26b657..bd25675 100644 --- a/src/index.js +++ b/src/index.js @@ -12,6 +12,10 @@ var initReporter = function (karmaConfig, baseReporterDecorator) { if (karmaConfig.jasmineHtmlReporter) { const config = karmaConfig.jasmineHtmlReporter; + if (config.suppressAll) { + this.onSpecComplete = () => void 0; + this.onRunComplete = () => void 0; + } if (config.suppressFailed) { this.specFailure = () => void 0; }