console.log not working on any karma project

末鹿安然 提交于 2019-12-03 12:48:51

Looks like karma added a feature in v1.5.0 to filter console capture by log level. Here's a link to the git pull request and the code changes showing what happened. I couldn't find any updates in the docs about this new feature. Based on the code changes, here are the new rules

You can configure browserConsoleLogOptions in your karma conf file to specify what messages should appear on your terminal output. Set the level property to specify the maximum level that should be displayed. To display all messages, set level to an empty string.

For my case, I needed to set it like this:

browserConsoleLogOptions: {
    terminal: true,
    level: ""
}

UPDATE: There's an open git issue discussing this. There are actually two changes in karma 1.5 that matter here.

  1. They changed the order of severity for log messages so that LOG == DEBUG. The severity used LOG > INFO. That means any project has log level set to INFO would show console.log messages in the old version and not show them in the new system.
  2. As mentioned above they added support to filter console by log level with browserConsoleLogOptions.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!