Grouping istanbul code coverage report by folder : <p>I'm running a code coverage report for NodeJs using istanbul and the nyc command.</p>

<p>I'm using mocha for my unit tests</p>

<p>I get a report for each file just as expected, but what I'd like to see is a report that has a single directory summary. Let me explain in a bit more detail what I'm getting verses what I'd like to see</p>

<p>All my source files are in a single folder and I'd like to see a summary of that one folder instead of a full list of every file in that folder</p>

<p>Here is what my folder structure looks like</p>

<pre><code>// This is the folder where all the sources are at 
src
    // This is the folder where coverage is output
    coverage
        NodeJs
            index.html
    file1.js
    file2.js
    file3.js
    // This is the folder where all tests are at
    tests
        test_file1.js
        test_file2.js
        test_file3.js
</code></pre>

<p>My <code>.babelrc</code> file looks like this</p>

<pre><code>{
    "presets": ["es2015", "stage-2"],
    "plugins": [
        [
            "istanbul",
            {"exclude": ["**/tests/*.js"]}
        ]
    ]
}
</code></pre>

<p>I'm using the following command to run my tests with coverage</p>

<pre><code>node ./node_modules/.bin/nyc --reporter=html \
    --report-dir=./src/coverage/NodeJs \
    ./node_modules/mocha/bin/_mocha \
    --require babel-core/register \
    --ui bdd src/tests/test*.js
</code></pre>

<p>All my tests run fine, they pass, and the report gets output to the <code>src/coverage/NodeJs/index.html</code> file as expected. In a browser, that report looks something like this:</p>

<p><a href="https://i.stack.imgur.com/O0SIJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/O0SIJ.jpg" alt="Coverage report for all files"></a></p>

<p>What I'd like to see is something like this where I can see a single full summary of the entire folder and then click on the folder to burrow down into it if necessary like this:</p>

<p><a href="https://i.stack.imgur.com/NQ4ZL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/NQ4ZL.jpg" alt="Coverage report for single folder"></a></p>

<p>Now, I can kinda get that effect if I have more than 1 folder that's covered. For example... If I get rid of the <code>exclude</code> in my <code>.babelrc</code> file, then there are 2 directories that are being covered (<code>src</code> and <code>src/tests</code>) and I get a summary of each like so</p>

<p><a href="https://i.stack.imgur.com/Qat6N.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Qat6N.jpg" alt="Coverage report with two folders"></a></p>

<p>But the problem with this is that I don't want my tests being covered... as you can see, it messes up the numbers. I just want a single folder being covered and would like to see a single folder summary in the HTML output file.</p>

<p>Any suggestions on how I can achieve this? (And if I didn't give enough information, please let me know)</p>
