test-exclude
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/bcoe/test-exclude/compare/v1.0.0...v1.1.0) (2016-06-08) | ||
### Features | ||
* set configFound if we find a configuration key in package.json ([#2](https://github.com/bcoe/test-exclude/issues/2)) ([64da7b9](https://github.com/bcoe/test-exclude/commit/64da7b9)) | ||
<a name="1.0.0"></a> | ||
@@ -7,0 +17,0 @@ # 1.0.0 (2016-06-06) |
@@ -13,7 +13,8 @@ const assign = require('lodash.assign') | ||
configKey: null, // the key to load config from in package.json. | ||
configPath: null // optionally override requireMainFilename. | ||
configPath: null, // optionally override requireMainFilename. | ||
configFound: false | ||
}, opts) | ||
if (!this.include && !this.exclude && this.configKey) { | ||
assign(this, pkgConf(this.configKey, this.configPath)) | ||
assign(this, this.pkgConf(this.configKey, this.configPath)) | ||
} | ||
@@ -51,3 +52,3 @@ | ||
function pkgConf (key, path) { | ||
TestExclude.prototype.pkgConf = function (key, path) { | ||
const obj = readPkgUp.sync({ | ||
@@ -58,2 +59,3 @@ cwd: path || requireMainFilename(require) | ||
if (obj.pkg && obj.pkg[key] && typeof obj.pkg[key] === 'object') { | ||
this.configFound = true | ||
return obj.pkg[key] | ||
@@ -60,0 +62,0 @@ } else { |
{ | ||
"name": "test-exclude", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "test for inclusion or exclusion of paths using pkg-conf and globs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,2 +39,3 @@ /* global describe, it */ | ||
e.shouldInstrument('batman.js').should.equal(false) | ||
e.configFound.should.equal(true) | ||
}) | ||
@@ -50,11 +51,13 @@ | ||
e.shouldInstrument('batman.js').should.equal(true) | ||
e.configFound.should.equal(true) | ||
}) | ||
it('should not throw if a key is missing', function () { | ||
exclude({ | ||
var e = exclude({ | ||
configPath: './test/fixtures/include', | ||
configKey: 'c' | ||
}) | ||
e.configFound.should.equal(false) | ||
}) | ||
}) | ||
}) |
8040
122