karma-runner/karma

Support console.dir for pretty-printed object dumps when captureConsole=true

开放

#1,763 创建于 2015年12月21日

 (1 条评论) (10 个反应) (0 位负责人)JavaScript (1,703 个派生)batch import
help wantedtype: feature

仓库指标

星标
 (11,918 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Sometimes when debugging I want to dump to console a pretty-printed object.

Normally in browser I'd use console.dir. In karma, this prints nothing, since dir is not listed here. I can use console.dir but the output is an ugly non-readable one-liner.

So the scope of this issue would be to

  1. enable logging for console.dir when captureConsole is true
  2. enhance a stringifier to be whitespace-aware (behing the flag), and pass that flag to the stringifier when logging from console.dir.
  3. maybe also change the depth in case of console.dir to be more than 3.

Would you be interested in receiving a PR with those changes?

贡献者指南