istanbul-lib-instrument
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1
@@ -346,3 +346,2 @@ /* | ||
* is done in the context of an anonymous function. | ||
* | ||
* Note that the semantics of the code *returned* by the instrumenter does not change in any way. | ||
@@ -353,2 +352,4 @@ * The function wrapper is "unwrapped" before the instrumented code is generated. | ||
* option is specified | ||
* @param {Function} [options.sourceMapUrlCallback] a callback function that is called | ||
* with a source map URL found in the original source. | ||
* @param {Boolean} [options.debug] assist in debugging. Currently, the only effect of | ||
@@ -449,3 +450,3 @@ * setting this option is a pretty-print of the coverage variable. Defaults to `false` | ||
}, | ||
filterHintsAndExtractSourceMap: function (comments) { | ||
filterHintsAndExtractSourceMap: function (comments, filename) { | ||
var ret = [], | ||
@@ -455,2 +456,3 @@ i, | ||
mapMatch, | ||
cb, | ||
groups; | ||
@@ -476,4 +478,5 @@ if (!(comments && isArray(comments))) { | ||
mapMatch = SOURCE_MAP_RE.exec(comment.value); | ||
if (mapMatch) { | ||
this.fileCoverage.setSourceMappingUrl(mapMatch[1]); | ||
cb = this.opts.sourceMapUrlCallback; | ||
if (cb && typeof cb === 'function') { | ||
cb(filename, mapMatch[1]); | ||
} | ||
@@ -525,3 +528,3 @@ } | ||
trackerVar: generateTrackerVar(filename), | ||
hints: this.filterHintsAndExtractSourceMap(program.comments), | ||
hints: this.filterHintsAndExtractSourceMap(program.comments, filename), | ||
currentHint: null, | ||
@@ -528,0 +531,0 @@ lastHintPosition: -1, |
@@ -21,2 +21,9 @@ /* | ||
BaseCoverage.call(this, pathOrObj); | ||
this.meta = { | ||
last: { | ||
s: 0, | ||
f: 0, | ||
b: 0 | ||
} | ||
}; | ||
} | ||
@@ -23,0 +30,0 @@ |
{ | ||
"name": "istanbul-lib-instrument", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0-alpha.1", | ||
"description": "Core istanbul API for JS code coverage", | ||
@@ -15,3 +15,3 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", | ||
"escodegen": "^1.7.0", | ||
"esprima": "^2.5.1", | ||
"esprima": "^2.7", | ||
"istanbul-lib-coverage": "^1.0.0-alpha" | ||
@@ -23,3 +23,3 @@ }, | ||
"coveralls": "^2.11.4", | ||
"istanbul": "^0.3.17", | ||
"istanbul": "^0.4", | ||
"js-yaml": "^3.3.1", | ||
@@ -26,0 +26,0 @@ "jshint": "^2.8.0", |
48838
1122
Updatedesprima@^2.7