tornaia / karma-sonarqube-unit-reporter

A Karma plugin. Unit tests execution report for SonarQube/Generic Coverage Plugin
MIT License
33 stars 28 forks source link

Silent Mode #45

Open KyleW opened 4 years ago

KyleW commented 4 years ago

Adds a silent mode. When silentMode is true, it skips the logging when mapping describe blocks to filenames.

SilentMode defaults to false so existing users should not see a change.

strille commented 4 years ago

I agree that the logging of the describe blocks are annoying.

An alternative solution to the silentMode flag would be to send the logger (log) to getFilesForDescriptions and have it use that instead of calling console.log. Then the describe blocks can be printed using log.debug(). Anyone interested in that output can simply increase the loglevel.

KyleW commented 4 years ago

I like that Idea better. I'll switch it to using log.debug.

KyleW commented 4 years ago

I looked into it and log.debug doesn't seem to be an option without a bigger refactor. Currently, the library doesn't use a logger other than what comes with node. As far as I can tell, there's nothing like log.debug available. I'd have to add winston or something to get log levels and even then I think I'd need to expose a log level flag.

I could switch from console.log to console.debug, but I believe those do exactly the same thing. 🤷‍♂

strille commented 4 years ago

I was thinking you could send in the log created for the reporter as an argument to fileUtil.getFilesForDescriptions, and use that: fileUtil.getFilesForDescriptions(testPaths, testFilePattern, log)