karma-sonarqube-unit-reporter icon indicating copy to clipboard operation
karma-sonarqube-unit-reporter copied to clipboard

Silent Mode

Open KyleW opened this issue 5 years ago • 4 comments

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.

KyleW avatar Nov 18 '19 21:11 KyleW

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.

strille avatar Nov 20 '19 09:11 strille

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

KyleW avatar Nov 20 '19 18:11 KyleW

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. 🤷‍♂

KyleW avatar Nov 20 '19 18:11 KyleW

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)

strille avatar Nov 21 '19 12:11 strille