Closed Floppy012 closed 1 year ago
ReportGenerator only uses the given coverage files to determine its results. It does not analyze any further information from the file/class itself.
Reason: ReportGenerator is agnostic to the used programming language. It supports all languages (if a supported coverage file format is available). Therefore it is not aware of packages or namespaces within the code files.
In your case you can use a little Powershell script to normalize the path information. This might look like the following example:
(gc "FileB.xml") | % { $_ -replace "/__w/redacted/redacted/", "/home/runner/work/redacted/redacted/" } | Out-File "FileB.xml" -Encoding UTF8
Thanks. I've already implemented the path normalization.
Correct me if I'm wrong. The <package>
tag and name
attribute of the <file>
tag aren't language specific but rather part of the Clover Spec. That's why I thought it could be used to identify a file rather than using the path. As the path always seem to be absolute while the package
hierarchy + filename
always seems to be relative to the configured root directory of the reporting utility.
I just took a closer look.
One problem is, that some other tools also generate Clover formatted coverage files.
But e.g. Jest does not comply with the "Clover Spec". It does not use <package>
elements.
See: https://github.com/danielpalme/ReportGenerator/pull/276
I think I will leave the current implementation as it is.
Description
When using multiple clover files regarding the same project but with different base paths, files will no longer be considered same.
Example
We split our code-testing into its different testing types (unit, component (virtual DOM), component (cypress)). These jobs produce three clover.xml files. Due to the complexity of Cypress it needs to use a container which has a different working directory path. ReportGenerator only seems to look at the file paths and not the package when merging.
In the clover files below the file
app.vue
is the same file (FQCN isclient.app.vue
for both clover files). ReportGenerator doesn't seem to use that. It uses the file path which ends up putting the file in twice in the final output.File A (without container):
File B (with container):
Clover output of ReportGenerator