Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Added 'text-folders' view to get folder-recursive totals #689

Closed
wants to merge 4 commits into from

Conversation

moos
Copy link

@moos moos commented Aug 28, 2016

Working on a sizable project (~700 files) I needed something between the file-based 'text' report and the sparse 'text-summary'. So I wrote this 'text-folders' report.

$ ./lib/cli.js report --root build/coverage/ text-folders
------------------------------|----------|----------|----------|----------|
Directory                     |  % Stmts | % Branch |  % Funcs |  % Lines |
------------------------------|----------|----------|----------|----------|
 istanbul/                    |    96.75 |    90.43 |    98.69 |    97.34 |
 istanbul/lib/                |    96.75 |    90.43 |    98.69 |    97.34 |
 istanbul/lib/command/        |    95.37 |    87.74 |     97.1 |    96.63 |
 istanbul/lib/command/common/ |    92.47 |    83.64 |      100 |    93.33 |
 istanbul/lib/report/         |    95.66 |    81.94 |    98.89 |    96.32 |
 istanbul/lib/report/common/  |    93.75 |       80 |      100 |    93.75 |
 istanbul/lib/store/          |      100 |      100 |      100 |      100 |
 istanbul/lib/util/           |    97.53 |    94.24 |    97.87 |    98.84 |
------------------------------|----------|----------|----------|----------|
All                           |    96.75 |    90.43 |    98.69 |    97.34 |
------------------------------|----------|----------|----------|----------|

Done

Still, for large projects, it'd be nice to control the level of detail, even at the folder level.

$ ./lib/cli.js report --root build/coverage/ text-folders --depth 2
------------------------------|----------|----------|----------|----------|
Directory                     |  % Stmts | % Branch |  % Funcs |  % Lines |
------------------------------|----------|----------|----------|----------|
 istanbul/                    |    96.75 |    90.43 |    98.69 |    97.34 |
 istanbul/lib/                |    96.75 |    90.43 |    98.69 |    97.34 |
------------------------------|----------|----------|----------|----------|
All                           |    96.75 |    90.43 |    98.69 |    97.34 |
------------------------------|----------|----------|----------|----------|

Done

Finally, I wanted to be able to target certain folders in the report, e.g., '/views/' or '/models/'. Of course, one could do istanbul report ... | grep views, but you'd lose the watermarks and styling.

$ ./lib/cli.js report --root build/coverage/ text-folders --match common
------------------------------|----------|----------|----------|----------|
Directory                     |  % Stmts | % Branch |  % Funcs |  % Lines |
------------------------------|----------|----------|----------|----------|
 istanbul/lib/command/common/ |    92.47 |    83.64 |      100 |    93.33 |
 istanbul/lib/report/common/  |    93.75 |       80 |      100 |    93.75 |
------------------------------|----------|----------|----------|----------|
All                           |    96.75 |    90.43 |    98.69 |    97.34 |
------------------------------|----------|----------|----------|----------|

Done

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 97.56% when pulling b725467 on moos:master into 89e338f on gotwarlost:master.

@moos
Copy link
Author

moos commented Aug 29, 2016

I have an another PR-in-waiting to add same to html report. See moos#1.

@moos moos closed this Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants