From abdab75112a6da880d7388bcbf492f7032d897a7 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 24 Jul 2013 23:37:17 +0100 Subject: [PATCH] Allow the developer to opt out of instrumentation --- lib/buster-istanbul.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/buster-istanbul.js b/lib/buster-istanbul.js index af527f0..d3a5a9a 100644 --- a/lib/buster-istanbul.js +++ b/lib/buster-istanbul.js @@ -21,8 +21,9 @@ function merge(paths) { } var setup = { - node: function(group) { + node: function(group, instrument) { coverage.hookRequire(); + if (instrument === false) return; group.sources.forEach(function(pattern) { glob.glob(pattern).forEach(function(fPath) { coverage.addInstrumentCandidate(fPath); @@ -44,6 +45,7 @@ var setup = { }); group.on('load:sources', function(rs){ + if (instrument === false) return; rs.addProcessor(function(resource, content){ return coverage.instrumentCode(content, resource['path'].replace(/\//, '')); }); @@ -86,7 +88,7 @@ module.exports = { }, configure: function(group) { - setup[group.environment](group); + setup[group.environment](group, this.options.instrument); var self = this; process.on("exit", function() { coverage.writeReports(self.options.outputDirectory);