diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-22 01:28:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-22 01:28:35 +0800 |
commit | eae2a4df8b8d8874f7e8115530e8f25ceb607b4e (patch) | |
tree | b83b5de5e5948f85cd5ff5886fe3b43e50d8fef8 /packages/sol-cov/src/coverage_subprovider.ts | |
parent | 11b35b89f5b7d0f1b91bdc15fa3079a5ea57da38 (diff) | |
parent | ade8e95d2e1c46bb1a3f8212a6eac5f396bc3e94 (diff) | |
download | dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar.gz dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar.bz2 dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar.lz dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar.xz dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.tar.zst dexon-sol-tools-eae2a4df8b8d8874f7e8115530e8f25ceb607b4e.zip |
Merge pull request #702 from perissology/feature/missing-sources
[sol-cov] Only collect coverage for provided sources
Diffstat (limited to 'packages/sol-cov/src/coverage_subprovider.ts')
-rw-r--r-- | packages/sol-cov/src/coverage_subprovider.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 065a48434..45843bc96 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -66,6 +66,12 @@ export const coverageHandler: SingleFileSubtraceHandler = ( ): Coverage => { const absoluteFileName = contractData.sources[fileIndex]; const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex]); + + // if the source wasn't provided for the fileIndex, we can't cover the file + if (_.isUndefined(coverageEntriesDescription)) { + return {}; + } + 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. |