Istanbul coverage nested directories in HTML report
Asked Answered
S

3

15

The unit test coverage report from Istanbul in HTML format displays every single folder of the project in the index.html.

It actually flattens the directory structure. Is there an option to render the html report with nested folders?

Shroudlaid answered 13/8, 2014 at 16:1 Comment(0)
L
1

If you use the coverage reporter attribute with 'lcov', it should be possible to view using a tool. It does give a folder structure. eg: https://lcov-viewer.netlify.app/report

Lingulate answered 23/2, 2023 at 5:47 Comment(0)
I
0

Copying my answer from a potential duplicate question:

Maybe try the --reporter=html-spa option.

See available options.

Example output (redacted)

Inexpressible answered 26/8, 2022 at 1:6 Comment(0)
S
-3

With Istanbul's new CLI, nyc, it is possible to create a .nycrc configuration file and specify using an array of globs, what files you want to include in your coverage report:

{
    ...
    "include": [
        "**/dist/myfile*.js",
        "**/test/**/*.spec.js"
    ],
    ...
}

Also it is possible to specify what files should be excluded too:

{
    ...
    "exclude": [
        "**/dist/myfile*.js",
        "**/test/**/*.spec.js"
    ],
    ...
}

More about this on GitHub.

Strachan answered 26/6, 2018 at 15:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.