Skip to content

Commit

Permalink
Added suppressAll option to config (#40)
Browse files Browse the repository at this point in the history
* 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 <pim@zzapps.nl>
  • Loading branch information
PVermeer and Pim Vermeer committed Mar 24, 2020
1 parent 9f2a946 commit 248a37e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -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) {
Expand All @@ -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
}

});
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 248a37e

Please sign in to comment.