Skip to content

Commit

Permalink
#603 Improved support for Cobertura files generated by Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Apr 13, 2023
1 parent fb069c8 commit d472d5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Readme.txt
Expand Up @@ -68,6 +68,7 @@ CHANGELOG

5.1.20.0

* Fix: #603 Improved support for Cobertura files generated by Jest
* Fix: Improved OpenCover support

5.1.19.0
Expand Down
13 changes: 12 additions & 1 deletion src/ReportGenerator.Core/Parser/CoberturaParser.cs
Expand Up @@ -232,7 +232,18 @@ private static CodeFile ProcessFile(XElement[] modules, Class @class, string cla
.Elements("line")
.ToArray();

var linesOfFile = lines
var lineNumbers = lines
.Select(l => l.Attribute("number").Value)
.ToHashSet();

var additionalLinesInMethodElement = classes.Elements("methods")
.Elements("method")
.Elements("lines")
.Elements("line")
.Where(l => !lineNumbers.Contains(l.Attribute("number").Value))
.ToArray();

var linesOfFile = lines.Concat(additionalLinesInMethodElement)
.Select(line => new
{
LineNumber = int.Parse(line.Attribute("number").Value, CultureInfo.InvariantCulture),
Expand Down

0 comments on commit d472d5d

Please sign in to comment.