karma-runner/karma

logger.js ignores layout.pattern

開放

#2,414 建立於 2016年10月19日

 (1 則留言) (0 個反應) (0 位負責人)JavaScript (1,703 個分叉)batch import
help wantedneeds: investigation

倉庫指標

星標
 (11,918 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Expected behaviour

In karma/lib/logger.js, setup should use the layout.pattern string if it exists.

Actual behaviour

When layout.type === 'pattern', setup only uses one of the built-in constants:

    var pattern = colors ? constant.COLOR_PATTERN : constant.NO_COLOR_PATTERN

Environment Details

  • Karma version (output of karma --version): 1.3.0
  • Relevant part of your karma.config.js file
    loggers: [
        {
            type: 'console',
            layout: {
                type: 'pattern',
                pattern: '%[%d{ISO8601}:%p [%c]: %]%m'
            }
        }
    ]

Steps to reproduce the behaviour

  1. Supply a custom logger in karma.config.js as specified above.

Comment

If this is indeed broken, I can submit a PR.

Further, I realize that fixing this to use the provided pattern will then ignore the colors boolean. This might be addressed by having layout.colorPattern and layout.noColorPattern which get assigned appropriately to layout.pattern. I can submit a PR for this as well.

Thanks.

貢獻者指南