From ca01f078a6667cc06bde3dee414ab5a812852be3 Mon Sep 17 00:00:00 2001 From: James Talmage Date: Fri, 18 Dec 2015 06:04:38 -0500 Subject: [PATCH] shortcut include glob if not provided --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index fabf2fa9c..568da13bb 100755 --- a/index.js +++ b/index.js @@ -34,8 +34,10 @@ function NYC (opts) { config = config.nyc || {} // load exclude stanza from config. - this.include = arrify(config.include || ['**']) - this.include = this._prepGlobPatterns(this.include) + this.include = false + if (config.include) { + this.include = this._prepGlobPatterns(arrify(config.include)) + } this.exclude = ['**/node_modules/**'].concat(arrify(config.exclude || ['test/**', 'test{,-*}.js'])) this.exclude = this._prepGlobPatterns(this.exclude) @@ -117,7 +119,7 @@ NYC.prototype.addFile = function (filename) { NYC.prototype.shouldInstrumentFile = function (filename, relFile) { relFile = relFile.replace(/^\.\//, '') // remove leading './'. - return (micromatch.any(filename, this.include) || micromatch.any(relFile, this.include)) && + return (!this.include || micromatch.any(filename, this.include) || micromatch.any(relFile, this.include)) && !(micromatch.any(filename, this.exclude) || micromatch.any(relFile, this.exclude)) }