browserConsoleLogOptions does not filter console by level
See original GitHub issueExpected behavior
I expect that if browserConsoleLogOptions.level === 'error'
, then any instance of console.log
, console.debug
or console.warn
will not appear in my terminal.
Actual behavior
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.
Enviroment Details
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.
Steps to reproduce the behaviour
- Clone the example repo found at https://github.com/jambonsw/webpack2-karma-logging-error-mve
- Install the packages with
npm install
- Run tests with
npm test
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
console.log not working on any karma project - Stack Overflow
You can configure browserConsoleLogOptions in your karma conf file to specify what messages should appear on your terminal output. Set the level property...
Read more >Run karma-ci script from karma rake task and set ... - GitLab
Ah, nevermind I was looking at browserConsoleLogOptions ... the one that corresponds to this CLI argument is logLevel which does not default to...
Read more >Console log levels is disabled - Google Groups
Since Chrome updated to 68.0.3440.106, I cannot change console log levels. The drop down box is disabled and grey: Screenshot from 2018-09-05 09-46-16.png....
Read more >filter-console - npm
Start using filter-console in your project by running `npm i filter-console`. There are 8 other projects in the npm registry using ...
Read more >can't bind to 'mat-dialog-close' since it isn't a known property of ...
LOG_DISABLE, browserConsoleLogOptions: { level: 'disable', terminal: false },. But no matter what I do, my console output looks like this (sample) :
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It 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 ifbrowserConsoleLogOptions.level
is set to'error'
. @dignifiedquire is this a wanted behaviour?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:
See #2602.