I expect that if browserConsoleLogOptions.level === 'error', then any instance of console.log, console.debug or console.warn will not appear in my terminal.
Instances of console.debug are still shown in my console, despite the following in my Karma configuration:
browserConsoleLogOptions: {
level: 'error',
format: '%b %T: %m',
terminal: true
},
Specifically, console.debug('hello there!'); results in DEBUG: 'hello there!' being printed when I run tests.
Note that switching browserConsoleLogOptions.terminal to false correctly silences all console output.
Karma 1.1.0 with Webpack 2 through Babel 6 on macOS 10.11.5 with npm 3.8.8 and node v5.11.0. Please see package.json for full requirements.
npm installnpm testIt seems that browserConsoleLogOptions.level is only taken into account for log files. There's no filter for reporters.
I'd like to help out with this one.
Also, I noticed that the current log levels are: ['log', 'error', 'warn', 'info', 'debug']
Since log has an higher level than error, console.log messages are always printed also if browserConsoleLogOptions.level is set to 'error'.
@dignifiedquire is this a wanted behaviour?
@dignifiedquire if you describe the correct behaviour i can take over this bugfix and propose a pr with possible solution
@vigreco yes we should keep this. The reasoning being that you usually use console.log for debugging, while still wanting to keep only errors otherwise.
This should be changed to what was described in the original report. Moving log down between warn and info.
can you merge it?
Also I think you missed to add the 'LOG' level itself to constants.js,
it should be:
exports.LOG_LOG = 'LOG'
exports.LOG_PRIORITIES = [
exports.LOG_DISABLE,
exports.LOG_ERROR,
exports.LOG_WARN,
exports.LOG_INFO,
exports.LOG_DEBUG,
exports.LOG_DISABLE,
exports.LOG_LOG
]
This change made the LOG level messages the lowest priority, which I think should not be the case based on the comment by @dignifiedquire above:
This should be changed to what was described in the original report. Moving log down between warn and info.
See #2602.
Most helpful comment
It seems that
browserConsoleLogOptions.levelis only taken into account for log files. There's no filter for reporters.I'd like to help out with this one.
Also, I noticed that the current log levels are:
['log', 'error', 'warn', 'info', 'debug']Since log has an higher level than error, console.log messages are always printed also if
browserConsoleLogOptions.levelis set to'error'.@dignifiedquire is this a wanted behaviour?