diff options
Diffstat (limited to 'node_modules/istanbul-lib-instrument/dist/instrumenter.js')
-rw-r--r-- | node_modules/istanbul-lib-instrument/dist/instrumenter.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/node_modules/istanbul-lib-instrument/dist/instrumenter.js b/node_modules/istanbul-lib-instrument/dist/instrumenter.js index 1307bfd8a..5c4e197c9 100644 --- a/node_modules/istanbul-lib-instrument/dist/instrumenter.js +++ b/node_modules/istanbul-lib-instrument/dist/instrumenter.js @@ -104,12 +104,15 @@ var Instrumenter = function () { * * @param {string} code - the code to instrument * @param {string} filename - the filename against which to track coverage. + * @param {object} [inputSourceMap] - the source map that maps the not instrumented code back to it's original form. + * Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the + * coverage to the untranspiled source. * @returns {string} the instrumented code. */ }, { key: 'instrumentSync', - value: function instrumentSync(code, filename) { + value: function instrumentSync(code, filename, inputSourceMap) { if (typeof code !== 'string') { throw new Error('Code must be a string'); } @@ -120,7 +123,8 @@ var Instrumenter = function () { sourceType: opts.esModules ? "module" : "script" }); var ee = (0, _visitor2.default)(t, filename, { - coverageVariable: opts.coverageVariable + coverageVariable: opts.coverageVariable, + inputSourceMap: inputSourceMap }); var output = {}; var visitor = { @@ -155,17 +159,20 @@ var Instrumenter = function () { * @param {string} code - the code to instrument * @param {string} filename - the filename against which to track coverage. * @param {Function} callback - the callback + * @param {Object} inputSourceMap - the source map that maps the not instrumented code back to it's original form. + * Is assigned to the coverage object and therefore, is available in the json output and can be used to remap the + * coverage to the untranspiled source. */ }, { key: 'instrument', - value: function instrument(code, filename, callback) { + value: function instrument(code, filename, callback, inputSourceMap) { if (!callback && typeof filename === 'function') { callback = filename; filename = null; } try { - var out = this.instrumentSync(code, filename); + var out = this.instrumentSync(code, filename, inputSourceMap); callback(null, out); } catch (ex) { callback(ex); |