aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 19:56:22 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 19:56:22 +0800
commit20826e0f08e0e812572aae6b879ea2a9162d93c4 (patch)
tree001aaedecefa34695c7a90463f11374687d4e5ed
parente4740961199ee6b34ad32dd242e0081afbb41a69 (diff)
downloaddexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.gz
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.bz2
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.lz
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.xz
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.tar.zst
dexon-0x-contracts-20826e0f08e0e812572aae6b879ea2a9162d93c4.zip
Add an explanatory comment for making ranges unique
-rw-r--r--packages/sol-cov/src/coverage_manager.ts1
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 = {};