jest-community / jest-junit

A Jest reporter that creates compatible junit xml files
Apache License 2.0
483 stars 109 forks source link

Line coverage in jest-junit report #265

Open Erry91 opened 4 months ago

Erry91 commented 4 months ago

I am using jest-junit to create a JUnit .xml report file. This report contains information on my test suites and test cases.

However I am trying to figure out what are the tools/options to generate a Junit xml report that includes also line coverage (like a lcov coverage report has for example, but it's not in JUnit format).

Is it possible to have jest-junit include line coverage in its produced report file?

Do you know if there is a conversion that can be made, if not?

Thank you in advance.

palmerj3 commented 4 months ago

There are a few different junit specs out there but none of them, that I'm aware of, include line coverage.

You could utilize the custom property functionality of jest-junit to add some line coverage numbers for each test suite. But test coverage is usually calculated after the tests run so I'm not sure you will have this information at the time jest-junit needs it.

The only other method would be to do some post processing of the junit file yourself somehow.

However, coverage usually isn't communicated to people on a per test or per suite basis. You usually care about the coverage of all the tests put together.

work933k commented 1 month ago

I think this issue can be closed..