2016-08-24 15 views
0

テスト用にカルマを使用していますが、テストの実行時間が終了したときにコンソールに印刷する方法があるかどうかを知りたいと思いますか?カルマ設定の実行終了時刻を追加します

ような何か:

Chrome 52.0.2743 (Mac OS X 10.11.6): Executed 126 of 126 SUCCESS (3.516 secs/3.087 secs) 
TOTAL: 126 SUCCESS 

=============================== Coverage summary =============================== 
Statements : 23.06% (1900/8238), 118 ignored 
Branches  : 16.29% (594/3646), 160 ignored 
Functions : 23.93% (589/2461), 77 ignored 
Lines  : 18.04% (1359/7532) 
================================================================================ 

Executed: 08-24-2016 11:34:59 
Finished: 08-24-2016 11:35:42 

答えて

0

あなたはカルマカバレッジとカルマスペックレポーターを使用する必要があります。

package.jsonに追加します。その後、

"karma-coverage": "1.1.0", 
"karma-spec-reporter" : "0.0.26" 

そして、あなたのカルマconfの中で:

reporters: ['spec, 'coverage'], 

コンフィグ一部:(ドキュメントから)

spec docs

specReporter: { 
    maxLogLines: 5,   // limit number of lines logged per test 
    suppressErrorSummary: true, // do not print error summary 
    suppressFailed: false, // do not print information about failed tests 
    suppressPassed: false, // do not print information about passed tests 
    suppressSkipped: true, // do not print information about skipped tests 
    showSpecTiming: true// print the time elapsed for each spec 
    }, 
    coverageReporter: { 
    type: 'html', 
    dir: 'release/coverage/' 
    } 

あなたはGEになりますあなたの要求に似た印刷物と、リリース/カバレッジディレクトリのカバレッジレポート。

+0

申し訳ありませんが、あなたは私の質問を得ましたか?私は最後に2行を除いてこの出力を持っています...それは私の要求です。これらの行をどのように追加するのですか?カスタムプリントをコンソールに挿入する方法は? – NikosKeyz

+0

私が知っている唯一のプラグインは、スペック記者1です。 showSpecTimingを有効にします。あなたの質問はちょうど「私は何かが欲しい」と言っていたので、私はそれを全部手に入れようとしました。 – PeterS

関連する問題