I've searched through the issues and found a couple of mentions of istanbul, but no one sharing the particular text output format it uses, e.g.
----------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------------|----------|----------|----------|----------|----------------|
All files | 79.41 | 57.5 | 83.78 | 79.41 | |
async-voter.js | 88.1 | 77.78 | 100 | 88.1 |... 49,75,76,77 |
index.js | 95 | 83.33 | 50 | 95 | 19 |
persist.js | 46.88 | 25 | 50 | 46.88 |... 55,69,77,79 |
----------------|----------|----------|----------|----------|----------------|
I find this quick and simple text output at the end of a test run to be super useful. Is there an existing textformatter that I can use with simplecov that will output this kind of data on the command line after a test run?
A bit like the rspec --profile option does?
Maybe this will require writing my own formatter? presumably simplecov can output data to the command line - not just static files?
Many thanks in advance
:wave:
An overview of existing formatters can be found here: https://github.com/colszowka/simplecov/blob/master/doc/alternate-formatters.md
Failing at that, yes you'd need your own formatter or we could make an official simplecov text formatter - quite honestly I don't have much time allocated for simplecov these days though.
@PragTob totally understand about not having much time :-) happy to write a formatter if you can point me at anything that will help me get started - are there any docs on making a formatter, or is it just a question of looking through the existing formatters to get a feel for how to create one?
@tansaku Sadly I think those are pretty much the best docs we got on that. For tests etc. we have a simple formatter here: https://github.com/colszowka/simplecov/blob/master/lib/simplecov/formatter/simple_formatter.rb
Taking a look at the result object and the methods it provides should give you the best way to look at it :)
Cheers!
thanks @PragTob - I just started playing with that simpleformatter in one of our projects - result.groups seems to be {} however many tests I run - weird - probably our project, but if that's a usual gotcha you know about ...
I should maybe start with a fresh project ...
@tansaku best to look at how the html formatter handles it, as it's by far the most used/tested one :)
ah, looks like someone did it already https://github.com/chetan/simplecov-console