Exemple #1
0
  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;
  }
Exemple #2
0
 getInstrumentedSource(storageVarName) {
   if (this._instrumentedSourceText === null) {
     this._instrumentedSourceText = _getCoverageTemplate()({
       instrumented: this._instrumentor,
       coverageStorageVar: storageVarName,
       source: this._instrumentor.instrument(this._origSourceText),
     });
   }
   return this._instrumentedSourceText;
 }