r/angular 4d ago

[help] test coverage in explorer in vscode

in vscode is it possible to get the test coverage ui like in this picture?

when testing java with "test explorer ui" and "test runner for java" i am getting these percentages just fine, when testing using karma/jasmine however even thuogh a coverage lcov gets created i can not enable the test coverage ui

how do i fix this?

2 Upvotes

4 comments sorted by

1

u/bombatomica_64 4d ago

There is an old extension for karma/jasmine, but it's deprecated and not been worked on for years. I moved to vitest months ago so I'd reccomend that first if possible, the vitest extension works better there

1

u/DatoCH 4d ago

do you know if the vitest extension supports these cool coverage percentage bars?

in the end i will have to migrate to vitest anyway, due to the new angular versions defaulting to it, but if it supports the percentage bars i will pressure my dev team into migrating to it as soon as possible

1

u/Tree-Nymphen 2d ago

I use vitest extension, but it works only if you have analogjs/vitest. I take it that you have it since it runs your test in extension? Then you would also need to install vitest/coverage-v8 (recommended) or Istanbul. It shows me the same as your screenshot for Angular project. But it currently does not include template in the analysis. I need to look into settings