Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma runner console - output only failed tests

This is default output of Karma test runner (with one failed test):

. ..   ... e 28.0 (Windows): Executed 413 of 421 (1 FAILED) e 28.0 (Windows): Executed 414 of 421 (1 FAILED) e 28.0 (Windows): Executed 415 of 421 (1 FAILED) e 28.0 (Windows): Executed 416 of 421 (1 FAILED) e 28.0 (Windows): Executed 417 of 421 (1 FAILED) e 28.0 (Windows): Executed 418 of 421 (1 FAILED) e 28.0 (Windows): Executed 419 of 421 (1 FAILED) e 28.0 (Windows): Executed 420 of 421 (1 FAILED) e 28.0 (Windows): Executed 421 of 421 (1 FAILED) e 28.0 (Windows): Executed 421 of 421 (1 FAILED) (1.74 secs / 1.091 secs) 

I don't like the fact that one have to scroll all the way up to the test that failed to see an exception. This might get annoying over the time so my question is whether is it possible to somehow change the output so that only tests that failed would be reported in the console?

So in the case of one failed test I would prefer output similar to this:

Chrome 28.0 (Windows) FailedTest only should be printed to console FAILED     ReferenceError: something is not defined         at null.<anonymous> (c:/SuperProject/src/test/FailedTest.js:10:10) Chrome 28.0 (Windows): Executed 71 of 421 (1 FAILED) 

instead of the output above.

like image 292
PrimosK Avatar asked Aug 08 '13 08:08

PrimosK


2 Answers

Looking at http://karma-runner.github.io/0.10/config/configuration-file.html

Have you tried setting the config to use an empty reporters array? Karma v0.10 defaults to a reporters config of ['progress'], which is likely causing your verbose output.

You might like the 'dots' reporter. You can try it on the CLI using

karma start yourconfig.js  --reporters dots 
like image 75
Steve Jansen Avatar answered Sep 22 '22 16:09

Steve Jansen


I found using the dots reporter and setting:

client: {     captureConsole: false } 

in the karma config file sorted my issues out. The client.captureConsole stops any console.log() showing up.

like image 39
Heather Roberts Avatar answered Sep 22 '22 16:09

Heather Roberts