Karma: How to remove annoying LOG: 'a' in tests

Created on 16 Sep 2014  路  6Comments  路  Source: karma-runner/karma

Recently, I have been noticing LOG: 'a' before each of my tests. Not sure how to disable it. There are 3600 console.log's in my project, ALL of them from dependencies.

Karma version: 0.11.14

Most helpful comment

@AlexCppns set client.captureConsole to equal false

//karma.config.js

client: {
  captureConsole: false
}

All 6 comments

@AlexCppns set client.captureConsole to equal false

//karma.config.js

client: {
  captureConsole: false
}

Well that works but I don't necessarily want to disable all logs, I just want to know where that log in particular comes from.

Yes, Alex, it's a crappy answer. At least you can see your logs, mine are via $logProvider and Karma helpfully hides them. Because of course nobody needs logging in a unit test. ffs

same issue - annoying!

http://karma-runner.github.io/2.0/config/configuration-file.html

browserConsoleLogOptions
Type: Object
Default: {level: "debug", format: "%b %T: %m", terminal: true}

Set it to browserConsoleLogOptions: { level: 'warn' }, in karma.conf.js.

The downside is that if you want to log something for debugging, you need to use warn() or error().

The %T in the format string is the log level, if you change format to %m you will only see the mssage.

browserConsoleLogOptions: { level: "debug", format: "%m", terminal: true}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

macjohnny picture macjohnny  路  5Comments

donaldpipowitch picture donaldpipowitch  路  3Comments

simonh1000 picture simonh1000  路  3Comments

anius picture anius  路  3Comments

ebacka picture ebacka  路  3Comments