zgosalvez/github-actions-report-lcov

Files changed coverage rate not shown

Opened this issue · 1 comments

Unfortunately the files changed coverage rate is not shown in the posted comment, only "n/a" is printed instead.

I am using v1.5.0, but had this with previous versions as well. I thought this might be fixed with the branch coverage now being calculated but the issues still seems to exist.
When looking at the output, the coverage per file looks fine.

Looking at the source code, I think this might be related to filtering out the files which are untouched.

lines = lines.filter((line, index) => {
if (index <= 2) return true; // Include header
for (const changedFile of changedFiles) {
console.log(`${line} === ${changedFile}`);
if (line.startsWith(changedFile)) return true;
}
return false;
});
if (lines.length === 3) { // Only the header remains
return ' n/a';
}

Is it maybe that the line does not start with the filename because it has the full path to the repo prepended?

Any ideas or suggestions appreciated!

I had the same problem, I solved by changing the lcov file to remove the full path, something like:
sed -i '' "s;$PWD/;;g" coverage/lcov.*.info