diff options
Diffstat (limited to 'node_modules/nyc/index.js')
-rwxr-xr-x | node_modules/nyc/index.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/node_modules/nyc/index.js b/node_modules/nyc/index.js index b31c1abcf..87ada2daf 100755 --- a/node_modules/nyc/index.js +++ b/node_modules/nyc/index.js @@ -79,6 +79,7 @@ function NYC (config) { }.bind(this), {}) this.hookRunInContext = config.hookRunInContext + this.hookRunInThisContext = config.hookRunInThisContext this.fakeRequire = null this.processInfo = new ProcessInfo(config && config._processInfo) @@ -311,6 +312,9 @@ NYC.prototype._wrapRequire = function () { NYC.prototype._addOtherHooks = function () { if (this.hookRunInContext) { + this._addHook('RunInContext') + } + if (this.hookRunInThisContext) { this._addHook('RunInThisContext') } } @@ -420,9 +424,15 @@ NYC.prototype._getCoverageMapFromAllCoverageFiles = function () { this.loadReports().forEach(function (report) { map.merge(report) }) - map.filter(function (filename) { - return _this.exclude.shouldInstrument(filename) - }) + // depending on whether source-code is pre-instrumented + // or instrumented using a JIT plugin like babel-require + // you may opt to exclude files after applying + // source-map remapping logic. + if (this.config.excludeAfterRemap) { + map.filter(function (filename) { + return _this.exclude.shouldInstrument(filename) + }) + } map.data = this.sourceMaps.remapCoverage(map.data) return map } |