extractRuntimeCoverageInfo() { const instrumentationInfo = this._instrumentor.objectify(); const coverageInfo = { coveredSpans: [], uncoveredSpans: [], sourceText: this._origSourceText, }; let nodeIndex; // Find all covered spans for (nodeIndex in this._coverageDataStore.nodes) { coverageInfo.coveredSpans.push(instrumentationInfo.nodes[nodeIndex].loc); } // Find all definitely uncovered spans for (nodeIndex in instrumentationInfo.nodes) { if (!this._coverageDataStore.nodes.hasOwnProperty(nodeIndex)) { coverageInfo.uncoveredSpans.push( instrumentationInfo.nodes[nodeIndex].loc ); } } return coverageInfo; }
getInstrumentedSource(storageVarName) { if (this._instrumentedSourceText === null) { this._instrumentedSourceText = _getCoverageTemplate()({ instrumented: this._instrumentor, coverageStorageVar: storageVarName, source: this._instrumentor.instrument(this._origSourceText), }); } return this._instrumentedSourceText; }