diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 19:56:22 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-12 19:56:22 +0800 |
commit | 20826e0f08e0e812572aae6b879ea2a9162d93c4 (patch) | |
tree | 001aaedecefa34695c7a90463f11374687d4e5ed /packages/sol-cov/src | |
parent | e4740961199ee6b34ad32dd242e0081afbb41a69 (diff) | |
download | dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.gz dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.zst dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.zip |
Add an explanatory comment for making ranges unique
Diffstat (limited to 'packages/sol-cov/src')
-rw-r--r-- | packages/sol-cov/src/coverage_manager.ts | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index b70ca6f3f..9b812446a 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -42,6 +42,7 @@ export class CoverageManager { const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex], fileName); let sourceRanges = _.map(coveredPcs, coveredPc => pcToSourceRange[coveredPc]); sourceRanges = _.compact(sourceRanges); // Some PC's don't map to a source range and we just ignore them. + // By default lodash does a shallow object comparasion. We JSON.stringify them and compare as strings. sourceRanges = _.uniqBy(sourceRanges, s => JSON.stringify(s)); // We don't care if one PC was covered multiple times within a single transaction sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === fileName); const branchCoverage: BranchCoverage = {}; |