aboutsummaryrefslogtreecommitdiff
path: root/node_modules/istanbul-lib-instrument/dist/visitor.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/istanbul-lib-instrument/dist/visitor.js')
-rw-r--r--node_modules/istanbul-lib-instrument/dist/visitor.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/node_modules/istanbul-lib-instrument/dist/visitor.js b/node_modules/istanbul-lib-instrument/dist/visitor.js
index 55a616848..cae5146f5 100644
--- a/node_modules/istanbul-lib-instrument/dist/visitor.js
+++ b/node_modules/istanbul-lib-instrument/dist/visitor.js
@@ -36,13 +36,17 @@ function genVar(filename) {
// and is the `this` for the individual coverage visitors.
var VisitState = function () {
- function VisitState(types, sourceFilePath) {
+ function VisitState(types, sourceFilePath, inputSourceMap) {
_classCallCheck(this, VisitState);
this.varName = genVar(sourceFilePath);
this.attrs = {};
this.nextIgnore = null;
this.cov = new _sourceCoverage.SourceCoverage(sourceFilePath);
+
+ if (typeof inputSourceMap !== "undefined") {
+ this.cov.inputSourceMap(inputSourceMap);
+ }
this.types = types;
this.sourceMappingURL = null;
}
@@ -484,13 +488,15 @@ var coverageTemplate = (0, _babelTemplate2.default)('\n var COVERAGE_VAR = (f
* @param {string} sourceFilePath - the path to source file
* @param {Object} opts - additional options
* @param {string} [opts.coverageVariable=__coverage__] the global coverage variable name.
+ * @param {object} [opts.inputSourceMap=undefined] the input source map, that maps the uninstrumented code back to the
+ * original code.
*/
function programVisitor(types) {
var sourceFilePath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'unknown.js';
- var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { coverageVariable: '__coverage__' };
+ var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { coverageVariable: '__coverage__', inputSourceMap: undefined };
var T = types;
- var visitState = new VisitState(types, sourceFilePath);
+ var visitState = new VisitState(types, sourceFilePath, opts.inputSourceMap);
return {
enter: function enter(path) {
path.traverse(codeVisitor, visitState);