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;
  }