Fix a bug when some parts of the profiling report were missing because of the coverage ignore lines

This commit is contained in:
Leonid Logvinov
2019-01-21 16:32:12 +01:00
parent 61910f264c
commit e5c4390489
3 changed files with 18 additions and 7 deletions

View File

@@ -50,6 +50,8 @@ export class CoverageSubprovider extends TraceInfoSubprovider {
}
}
const IGNORE_REGEXP = /\/\*\s*solcov\s+ignore\s+next\s*\*\/\s*/gm;
/**
* Computed partial coverage for a single file & subtrace.
* @param contractData Contract metadata (source, srcMap, bytecode)
@@ -65,7 +67,7 @@ export const coverageHandler: SingleFileSubtraceHandler = (
fileIndex: number,
): Coverage => {
const absoluteFileName = contractData.sources[fileIndex];
const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex]);
const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex], IGNORE_REGEXP);
// if the source wasn't provided for the fileIndex, we can't cover the file
if (_.isUndefined(coverageEntriesDescription)) {