diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-15 21:45:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 21:45:02 +0800 |
commit | 18084588ea9fa724d6e32c9a49c79d49f189ba7c (patch) | |
tree | 7944152430a9687e7e63db4011bacaf2fa3aebe3 /packages/sol-coverage | |
parent | 16a2cf7be68605def2824de4f5c22f0154c2e6ad (diff) | |
parent | 64d99dc07cc82c7cc2917871596b46985f1d709f (diff) | |
download | dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.gz dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.bz2 dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.lz dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.xz dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.zst dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.zip |
Merge pull request #1498 from 0xProject/fix/sol-cov
Sol tracing fixes
Diffstat (limited to 'packages/sol-coverage')
-rw-r--r-- | packages/sol-coverage/src/coverage_subprovider.ts | 6 | ||||
-rw-r--r-- | packages/sol-coverage/src/index.ts | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/sol-coverage/src/coverage_subprovider.ts b/packages/sol-coverage/src/coverage_subprovider.ts index e6b546c4a..d03963ed6 100644 --- a/packages/sol-coverage/src/coverage_subprovider.ts +++ b/packages/sol-coverage/src/coverage_subprovider.ts @@ -74,19 +74,19 @@ export const coverageHandler: SingleFileSubtraceHandler = ( let sourceRanges = _.map(subtrace, structLog => pcToSourceRange[structLog.pc]); 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. + // By default lodash does a shallow object comparison. 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 === absoluteFileName); const branchCoverage: BranchCoverage = {}; const branchIds = _.keys(coverageEntriesDescription.branchMap); for (const branchId of branchIds) { const branchDescription = coverageEntriesDescription.branchMap[branchId]; - const isBranchCoveredByBranchIndex = _.map(branchDescription.locations, location => { + const branchIndexToIsBranchCovered = _.map(branchDescription.locations, location => { const isBranchCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, location)); const timesBranchCovered = Number(isBranchCovered); return timesBranchCovered; }); - branchCoverage[branchId] = isBranchCoveredByBranchIndex; + branchCoverage[branchId] = branchIndexToIsBranchCovered; } const statementCoverage: StatementCoverage = {}; const statementIds = _.keys(coverageEntriesDescription.statementMap); diff --git a/packages/sol-coverage/src/index.ts b/packages/sol-coverage/src/index.ts index 97b4ecee6..6a91a3966 100644 --- a/packages/sol-coverage/src/index.ts +++ b/packages/sol-coverage/src/index.ts @@ -4,6 +4,8 @@ export { TruffleArtifactAdapter, AbstractArtifactAdapter, ContractData, + SourceCodes, + Sources, } from '@0x/sol-tracing-utils'; export { |