Skip to content

Commit

Permalink
Fix line hit values of undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
Derrick committed May 26, 2020
1 parent dd72bf5 commit 43f176e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const transformJsonCoverage = coverage => {
stats: [
{
name: 'Hits',
value: lines[lineNumber]
value: method.Lines[lineNumber]
}
]
}
Expand Down
9 changes: 9 additions & 0 deletions test/transforms-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ describe('transforms', () => {
const methods = Object.keys(classObj)
const method = classObj[methods[1]]
const lines = Object.keys(method.Lines)

const transformed = transforms.getLines(method)

assert.equal(transformed.length, lines.length)

transformed.forEach((transformedLine, i) => {
const lineNumber = transformedLine.line;
const transformedHitCount = transformedLine.stats.find(s => s.name === 'Hits').value;
const originalHitCount = method.Lines[lineNumber];
assert.equal(transformedHitCount, originalHitCount)
});
})
})

0 comments on commit 43f176e

Please sign in to comment.